I am wondering how to use NUnit correctly. First, I created a separate test project that uses my main project as reference. But in that case, I am not able to test private m
In theory of Unit Testing only contract should be tested. i.e. only public members of the class. But in practice developer usually wants to test internal members to. - and it is not bad. Yes, it goes against the theory, but in practice it can be useful sometimes.
So you if really want to test internal members you can use one of these approaches:
Code example (pseudo code):
public class SomeClass
{
protected int SomeMethod() {}
}
[TestFixture]
public class TestClass : SomeClass{
protected void SomeMethod2() {}
[Test]
public void SomeMethodTest() { SomeMethod2(); }
}