Questions tagged [nunit]
For questions about NUnit, an open source unit testing framework for Microsoft .NET.
22 questions
1 vote
1 answer
176 views
NUnit testOf attribute usage
What are the use cases of TestOf? I'm new to NUnit testing and from what I have seen, most people don't use this attribute that much. From my experience, TestOf helped me to quickly identify what ...
0 votes
3 answers
2k views
Unit Testing: Constructor Injection with Fake Objects - Bad Tests?
In The Art of Unit Testing, 2nd Ed., the author gives the following example for injecting a stub using constructor injection and a "fake object". The goal of the "fake object" is to inherit the ...
1 vote
1 answer
293 views
NUnit specify TestCaseAttribute on implementation or create a test method
Based on this question about the correct usage of nUnit's TestCaseAttribute, I was wondering whether to specify the test case directly on the implementation or create test methods (as when using ...
0 votes
1 answer
101 views
Should I be duplicating Equality methods in the test project?
I have read plenty of questions on here about overriding .equals and .hashcode for testing purposes only. My Domain classes have implemented .equals and .hashcode. Should I be 1) Duplicating these ...
7 votes
1 answer
2k views
Should the expected value be hard-coded into the Assert
My own personal preference would be to use a variable, but maybe there are reasons against this? I haven't been able to find any resources that state the pros or cons of using one of these over the ...
6 votes
5 answers
4k views
How can I test parts of my application against the output of third party application?
I have a fairly new C# application, approximately 6 months old, that we are now trying to incorporate testing into. (Should have been done from the start but I can't change the past) Parts of this ...
3 votes
2 answers
2k views
NUnit SetUp and TearDown
I have some experience in MS Test but new to NUnit. Whether NUnit [Setup] is corresponding to [ClassInitialize] or [TestInitialize] in MS Test? What is the NUnit attribute corresponding to [...
7 votes
3 answers
917 views
BDD in .NET - Chicken or Egg or..?
Predicate: I'm brand new to BDD / TDD, but I've done my homework. I'm trying to put everything I've read / learned into practice with VS2010, SpecFlow and NUnit. Things are working, but it's quickly ...