In a C# class library, and set of tests. Everything was going well until I added a new set of tests - they run correctly on my machine, but fail on the TFS Build server. The stack trace in the build log makes no sense - the constructor of one class appears to be mapped to one of it's methods.
If my class looks a little like this:
1. public class ClassToBeTested
2. {
3.
4. /// <summary>
5. /// Default constructor.
6. /// </summary>
7. public ClassToBeTested()
8. {
9.
10. }
11.
12. /// <summary>
13. /// Default constructor.
14. /// </summary>
15. public MethodToTest()
16. {
17. /* do stuff that throws exception */
18. }
19.
20. }
And in my unit test class I have this:
1. [TestMethod()]
2. public void UpdateTest()
3. {
4. ClassToBeTested Target = new ClassToBeTested();
5. ClassToBeTested.MethodToTest();
6. }
Then my stack trace indicates this:
Test method unittestclass.UpdateTest threw exception /whatever/
ClassToBeTested.MethodToTest() : Line 17
unittestclass.UpdateTest() : Line 4
How is this possible?