Install-Package NUnit
This package includes all assemblies needed to create unit tests.
Tests can be executed using one of the following methods:
Visual Studio Unit Test Window
Console runner
Third party runner that supports NUnit 3
Visual Studio Unit Test Window
To execute tests using ...
[TestFixture]
public class UnitTest1
{
class Message
{
public string Text { get; } = "Hello World";
}
[Test]
public void HelloWorldTest()
{
// Act
var message = new Message();
// Assert
Assert.That(message.Tex...
Ever wondered why you cannot use Assert.Equals() for both Nunit and MSTest. If you have not then maybe as a start you need to be aware that you cannot use this method. Instead you would use Assert.AreEqual() to compare two objects for equality.
The reason here is very simple. Like any class the Ass...
[TestCase(0, 0, 0)]
[TestCase(34, 25, 59)]
[TestCase(-1250, 10000, 8750)]
public void AddNumbersTest(int a, int b, int expected)
{
// Act
int result = a + b;
// Assert
Assert.That(result, Is.EqualTo(expected));
}