Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [nunit]

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.

Filter by
Sorted by
Tagged with
5
votes
1answer
160 views

Simple HttpClient usage for integration tests in .NET Core

I have this simple setup for a .NET Core project which is just a very basic HttpClient usage to do some simple integration tests to a RESTful API. For now the test project remains separated from the ...
3
votes
3answers
109 views

Unit tests for a function that calculates demerit points for speeding

I'm currently working on a unit testing course (NUnit 3.x). I've been tasked with a simple class to test all edge cases. ...
4
votes
4answers
283 views

Poker Game: Unit testing different poker hands without violating DRY principles

I'm currently in the process of refactoring an old poker game which violates many of the SOLID principles. I was trying to use the TDD approach to refactoring and I found myself having to hard code ...
3
votes
1answer
1k views

Unit-testing event aggregator

I have written event aggregator with the following API (just for the fun of it, I am aware that nuget has like 100 similar implementations): ...
3
votes
0answers
708 views

Navigate to three pages in parallel with Selenium, ChromeDriver, and NUnit

As an experiment, I've created an NUnit test project that should, when running all tests, open three browser windows simultaneously, and each should load a particular page before closing. My question ...
2
votes
1answer
185 views

Proxy test class approach to allow covering legacy code with unit tests

There is huge legacy class MyService in which several new business cases need to be implemented. Unfortunately we are not allowed to touch existing legacy code ...
1
vote
1answer
412 views

REST API wrapper testing

I'm writing wrapper for REST API of a service. In my wrapper I have quite simple method: ...
1
vote
1answer
58 views

Functional tests for a web app repeating the same code

My problem/concern is that I am trying to remove duplicate code from my functional tests without breaking the Page Object Pattern that I am following. If you look at the code below, you will notice ...
10
votes
1answer
2k 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) The ...
4
votes
1answer
362 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
163 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: ...
3
votes
1answer
979 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
466 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
269 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, <...
15
votes
3answers
2k 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
297 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
181 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
983 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
4answers
4k 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 a ...
3
votes
3answers
3k 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 String...
10
votes
4answers
3k 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
52 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
2k 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
249 views

How can I better the readability of inline test data?

...
2
votes
1answer
91 views

Multiple Services and Test Setup

Class To Test Some methods hidden for clarity ...
8
votes
2answers
226 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: ...
6
votes
2answers
18k 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
2k 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 ...
9
votes
5answers
13k 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 ...