NUnit is an open source unit testing framework for Microsoft .NET and Silverlight written in C#. It serves the same purpose as JUnit does in the Java world, and is one of many in the xUnit family.

learn more… | top users | synonyms

8
votes
1answer
105 views

TDD - Kata - String Calculator

This is my first TDD Kata I've done and I'd appreciate it if someone could review it. String Calculator Create a simple String calculator with a method int Add(string numbers) ...
4
votes
1answer
58 views

Unit Testing Input Class in Monogame

I'm new to unit testing, and to learn, I've decided to "contribute" to Monogame to help with their testing efforts. The issue at hand is to test the input device classes. I've started with the GamePad ...
1
vote
0answers
99 views

Saving the state of a ViewModel

I've the following scenario, I've got some viewmodel that need to persist their state on disk. I've defined a custom attribute as: ...
2
votes
1answer
74 views

Mocking IElasticClient in unit tests

I'm trying to unit test how my class responds to a NEST 1.7 IElasticClient's return values, using NUnit 2.6.4 and Moq 4.2. I feel mocking the ...
8
votes
4answers
360 views

Implementing common fraction using TDD

Recently, during the interview, I was asked to implement basic arithmetic operations with common fractions using TDD. The task is fairly simple, but I was nervous so I did not do too well. :) Later on ...
1
vote
1answer
131 views

RPG Character with fluent interface

(Follow-up on RPG Character Builder) This implements a fluent interface for RPG game characters. Is this a valid implementation? There are 3 characters: Paladin, <...
14
votes
3answers
1k views

RPG Character Builder

This implements a builder pattern for RPG game characters. Is this a valid builder pattern implementation? There are 3 characters: Paladin, Wizard and Elfo. There are 3 items: Potion, Sword, Arch. ...
3
votes
1answer
98 views

Unit testing a service to return items from a database

I have been a developer for many years and get core development concepts, as well as unit testing ones such as DI/Ioc, Mocking etc. I also understand the values, importance of unit testing and writing ...
4
votes
1answer
91 views

Unit testing a CharGrid

I wrote NUnit tests for class CharGrid from this homework assignment. My goal here is DRY: I want to keep the testing code as short and simple as possible. In addition, want to run every test ...
4
votes
2answers
256 views

TDD - String Calculator Kata

Would really appreciate it if someone could please review my String Calculator TDD KATA. String Calculator Create a simple String calculator with a ...
3
votes
3answers
557 views

TDD Supermarket Pricing Kata

I have done the supermarket pricing kata in TDD style and I would appreciate it if someone could review it for me. Kata: "...checkout that calculates the total price of a number of items. In ...
2
votes
3answers
1k views

String Calculator Kata Code in TDD style

I have done the following kata in TDD style and would appreciate it if someone could review my code and my tests. String Calculator Create a simple ...
6
votes
4answers
831 views

Unit testing IValueConverter

I am just starting to implement unit testing into my project and familiarizing myself with NUnit. I have added unit tests for encryption/decryption methods that I have implemented, and am looking for ...
2
votes
1answer
36 views

Structuring Test Data

I'm just getting started with F# and was writing some unit tests for some functionality I had written. In the interest of brevity, I decided to create some lists of the different test cases and just ...
3
votes
2answers
131 views

Correct way to cover dependencies in unit tests

My approach to unit testing feels very wrong. I feel like I am missing something very basic, and I'm looking for some insight please. Let's assume that I am testing a method (I'm using NUnit) that ...
6
votes
2answers
223 views
2
votes
1answer
74 views

Multiple Services and Test Setup

Class To Test Some methods hidden for clarity ...
8
votes
2answers
183 views

Testing classes

I'm just getting into testing and wanted to see if someone can tell me if I'm writing tests correctly. I'm using C#, NUnit, & Should. This is the class I'm testing: ...
4
votes
2answers
8k views

REST Web Api unit test endpoint validity with NUnit and Moq

I am unit testing that the URL that I give to my IRestClient is valid. This client talks to a third party Web API. The test is as below: ...
2
votes
1answer
974 views

Testing database table creation with NUnit

I'm new to using NUnit and have written a test to check for the existence of a database table. I have the below code that should check whether a new table named NewTable has been created in the ...
8
votes
5answers
7k views

Function for determining triangle type

A while back I was asked to write some sample code for a job that I was applying for. They wanted a class that had a function that would accept three lengths and return the appropriate type of ...