VS2008 unit tests - assert method exits
问题 I'm trying to write a C# unit test with VS 2008's built-in unit testing framework and the method I'm testing calls Environment.Exit(0) . When I call this method in my unit test, my unit test is Aborted. The method should indeed be calling Exit , and I want a way to test that it does, and also to test the exit code that it uses. How might I do this? I looked at Microsoft.VisualStudio.TestTools.UnitTesting Namespace but didn't see anything that looked relevant. [TestMethod] [DeploymentItem(