Hi,
I need to perform unit-testing on classes that access the command-line arguments. In order to do that, I need to control the command-Line arguments.
Is there a way to do that (and still be able to run all the test automatically)
Thank you,
Sharon

Setting command-line arguments for a unit-test project
rabin
Gary Halberstadt
srjing2
Hi Sharon277,
I want to make sure I understand correctly. You have a command-line application with classes in it that refer to arguments they expect to be passed to the application at start, and you want to do unit tests against the methods in those classes
The way those classes are instantiated so VS can do unit testing against them is entirely different than normal execution. The executable is not run like normal, and neither you nor VS can provide arguments to it.
The classes are instantiated indepdently of program execution by using the binary as a class library.
In order to set the properties of the command-line arguments you may need to consider adding a testing hook to access and set them, which you would use in the unit test after instantiation but before calling the methods.
Cheers,
David R. Williamson