Questions tagged [nunit]

For questions about NUnit, an open source unit testing framework for Microsoft .NET.

Filter by
Sorted by
Tagged with
0 votes
3 answers
1k views

Are C# unit tests running independently from each other?

I'm using C# with NUnit. Let's say you have a class public class MyClass { private int classMember; [Test] public void Test1() { classMember = 1; Assert.That(classMember ==...
BunnyEarsAreLong's user avatar
0 votes
3 answers
1k 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 ...
8protons's user avatar
  • 1,369
1 vote
1 answer
450 views

Unit testing an existing project by creating interfaces for all public classes (including GUI forms)

This is an existing C# .NET WinForms project. I assume it was not developed with unit tests in mind from the very beginning. It uses a Model-View-Controller architecture, and the backend is a content ...
Al2110's user avatar
  • 245
-4 votes
1 answer
308 views

TestCaseSource in NUnit 3.12.0

I have this unit test: [Test] [AutoMoqData] [TestCaseSource(typeof(PhoneNumberTestCases))] public void PopulatesPhoneProperty( string inputValue, string ...
Ben's user avatar
  • 11
1 vote
1 answer
254 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 ...
user avatar
5 votes
5 answers
2k views

Should all class public methods come from an interface?

I'm currently learning about TDD techniques, one of the suggestion is to test only public methods and skip the private ones. I have also been reading about Mocking. If I want to mock a certain method, ...
ArturoO's user avatar
  • 167
0 votes
1 answer
91 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 ...
w0051977's user avatar
  • 7,021
2 votes
1 answer
5k views

How to prepare for INTERVIEW with PAIR PROGRAMMING (C#) [closed]

I have a stage in an interview process where I am supposed to do pair programming, or at least they want to see me working in Visual Studio with an experienced developer. This is a company promoting ...
Learn Languages From Music's user avatar
7 votes
1 answer
1k 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 ...
Erik Philips's user avatar
0 votes
1 answer
858 views

Selenium-Nunit Program Structure

My office has a suite of web reporting engines written in VB. All in all there's about 300 reports with varying displays depending on the data being input into them. I'm trying to establish an ...
Jacobm001's user avatar
  • 135
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 ...
user avatar
40 votes
13 answers
25k views

How do we make unit tests run fast?

We have reached the point in our project where we have almost a thousand tests and people have stopped bothering with running them before doing a check in because it takes so long. At best they run ...
Ziv's user avatar
  • 2,996
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 [...
LCJ's user avatar
  • 977
12 votes
3 answers
9k views

Where should I draw the line between unit tests and integration tests? Should they be separate?

I have a small MVC framework I've been working on. It's code base definitely isn't big, but it's not longer just a couple of classes. I finally decided to take the plunge and start writing tests for ...
Earlz's user avatar
  • 22.7k
7 votes
3 answers
881 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 ...
Tom Tom's user avatar
  • 173
16 votes
5 answers
10k views

How to structure unit tests for a GUI app using C# and NUnit

I've been asked to do a small side-project to supply a simple application to one of our customers. Normally I would be working on back-end code where I have all of my testing needs figured out, and I'...
S.Robins's user avatar
  • 11.4k
1 vote
1 answer
191 views

Interested in Feedback on QA System Design

I'm in the beginning phases of creating a QA system and I want to make sure that the design decisions that I'm making now make sense and won't bite me in the butt later on. If you have even the ...
sooprise's user avatar
  • 1,065
3 votes
3 answers
2k views

Making Separate Assemblies For Different Types Of Tests For The Same Component?

I was told by a few members here that splitting up my unit tests into different assemblies for different components is the best way to structure unit tests. Now, I have a few questions about that ...
sooprise's user avatar
  • 1,065
7 votes
3 answers
398 views

Long-Term Strategy For Implementing a QA System?

I have been given the task of implementing some QA testing into a massive existing system. We're going to start out with system-level tests and might add unit tests if it is deemed necessary. I ...
sooprise's user avatar
  • 1,065
6 votes
3 answers
197 views

Dealing with resistance to testing code

I've recently switched jobs. At my previous job, everyone wrote tests and we were all in a happy place. In my new role, I've been asked to setup CI and testing. I'm experiencing some resistance to ...
user avatar
26 votes
4 answers
23k views

What is the best unit test framework for .NET and why? [closed]

It seems to me that everyone uses NUnit without even considering the other options. I think this is because: Everyone is familiar with it already so they won't have to learn a new API. It is already ...
Nobody's user avatar
  • 2,613
12 votes
3 answers
3k views

How does NUnit for C# compare with Unit Test facility integrated with Visual Studio

I need to work in a team to develop a mid scale Desktop application developed using C# .NET. Prior to this, I have not applied Unit Testing and Test Driven Development. I am aware that there exists ...
Shamim Hafiz - MSFT's user avatar