addded test for negative numbers

This commit is contained in:
Geir Okkenhaug Jerstad 2025-01-03 13:34:56 +01:00
parent 5b6d47da85
commit 19b899b557

View file

@ -8,6 +8,14 @@ public class Tests
var calc = new Calc.Calculator();
var sum = calc.LeggSammen(1, 2);
Assert.That(sum, Is.EqualTo(3));
}
[Test]
public void TestLeggSammenNetgativ()
{
var calc = new Calc.Calculator();
var sum = calc.LeggSammen(-1, 2);
Assert.That(sum, Is.EqualTo(1));
}
[Test]
@ -17,7 +25,13 @@ public class Tests
var sum = calc.TrekkFra(2, 1);
Assert.That(sum, Is.EqualTo(1));
}
[Test]
public void TestTrekkFraNetgativ()
{
var calc = new Calc.Calculator();
var sum = calc.TrekkFra(1, -2);
Assert.That(sum, Is.EqualTo(3));
}
[Test]
public void TestMultipliser()
{
@ -25,6 +39,13 @@ public class Tests
var sum = calc.Multipliser(2, 2);
Assert.That(sum, Is.EqualTo(4));
}
[Test]
public void TestMultipliserNegativ()
{
var calc = new Calc.Calculator();
var sum = calc.Multipliser(3, -3);
Assert.That(sum, Is.EqualTo(-9));
}
[Test]
public void TestDivision()
@ -33,7 +54,13 @@ public class Tests
var sum = calc.Divider(4, 2);
Assert.That(sum, Is.EqualTo(2));
}
[Test]
public void TestDivisionNegative()
{
var calc = new Calc.Calculator();
var sum = calc.Divider(4, -2);
Assert.That(sum, Is.EqualTo(-2));
}
[Test]
public void TestDivisionByZero()
{