For unit tests I would like to mimic different commandline arguments. How do I modify the commandLine args to my program at runtime (looked around but can’t find the trick)? Basically I am trying to find a way to modify the contents of the READONLY property Environment.CommandLine.
Share
You can’t, this is ‘hard’ read-only. It comes out of Windows, GetCommandLine API function, it doesn’t allow modifying it either. You’ll have to mock it.