Part 2 – Unit Testing with NUnit

This is second part of videos series “Unit Testing with NUnit”. In this video, you will learn how you can use NUnit to write & execute your test cases.

Open source unit testing framework for .NET applications

Steps (how to use it)
Create a Console Application
Add a Class in it (e.g. Magician) and one method in it
Add Class Library Project in your solution
Install nunit Package (current is 3.11.0)
Install-Package NUnit -Version 3.11.0
Check & Install “NUnit Test Adapter 3” Extension
Add a class to write Test Cases
Apply [TestFixture] attribute on class
Add methods in this class
Apply [Test] or [TestCase] attributes on method

You normally do three things (AAA) in your Test method
Arrange (Prepare result)
Act (Call method to be tested)
Assert (Check result with expected value)

Code can be found here

Leave a Reply