c# - How to integration test console application in solution? -


i have console app (which later installed windows service) runs infinite loop reads messages queue , message.

i'd create automated test case launch test end-to-end behavior. question is, what's best way launch application in unit test? use process.start? or can reference program.cs - static void main directly , run that?

ideas? sample code appreciated, thanks!

[update: yes, know integration test. i've updated title. i've separated out logic business logic. value of integration testing in automated fashion. makes sure config settings correct, there issues assembly versions ok, logging , database , queue , cache access running, etc.]

when create type of setup, put of work in separate dll. windows service / console app in tiny project delegates of work dll. of functional testing happens against dll.

to test final executable, launch process (presuming test generating messages console add handles in way unit test can measure).

make sure have appropriate means of terminating console app (such sending "shutdown" message), , check process exits in unit test.

if have multiple unit tests want launch console app not able run tests in parallel if each individual test starts console app. in case, have test class responsible starting , ending process, rather each individual unit test.


Comments