I am new to C# and am having a particularly difficult time figuring out how test assemblies work. This is my Solution directory (with a single project MyProject inside of it):
MySolution/MySolutionFile.sln -- My Solution File
MySolution/packages -- My Packages Directory
MySolution/MyProject/Properties -- My Project Properties
MySolution/MyProject/src -- My Source Code
/src/MyClass1.cs
/src/MyClass2.cs
MySolution/MyProject/test -- My NUnit Tests
/test/MyClass1Test.cs
/test/MyClass2Test.cs
MySolution/MyProject/TheMainClass.cs
Now I can run all the tests in the test folder from visual studio. However I want to run the tests from a CI system like TeamCity, in which case I need an assembly path. How do I generate just the test folder into an assembly to be run.
Do I need to add to the main class a method that runs each test in the MySolution/test folder?
I think you need to read about projects and solutions: http://msdn.microsoft.com/en-us/library/ee817674.aspx
And after that it all becomes more clear: Have one solution, inside of that solution create a project for your application and a project for your unit-tests. In test-project add reference to the testing framework of your choice and a reference to your application-project.
This way your application does not know about your tests and compiled into one assembly. At the same time your tests depend on your application, but compiled into another assembly, which can be used by your test-runner GUI/CI or whatever else you use.
And to answer your next question, for test-project you need to choose project type of "Library" (console application will work as well if you like)