Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions Tests/UnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,119 +8,119 @@ public class Math
{
// Add tests
[Test]
public void Add_Valid()
public void Add_ValidBernt()
{
Assert.AreEqual(3, Program.Add("1", "2"));
Assert.AreEqual(5, Program.Add("3", "2"));
Assert.AreEqual(12, Program.Add("5", "7"));
}

[Test]
public void Add_Invalid()
public void Add_InvalidBernt()
{
Assert.Throws<FormatException>(() => Program.Add("1", "a"));
Assert.Throws<FormatException>(() => Program.Add("a", "1"));
Assert.Throws<FormatException>(() => Program.Add("a", "a"));
}

[Test]
public void Add_Null()
public void Add_NullBernt()
{
Assert.Throws<ArgumentNullException>(() => Program.Add("1", null));
Assert.Throws<ArgumentNullException>(() => Program.Add(null, "1"));
Assert.Throws<ArgumentNullException>(() => Program.Add(null, null));
}
// Subtract Tests
[Test]
public void Subtract_Valid()
public void Subtract_ValidBernt()
{
Assert.AreEqual(-1, Program.Subtract("1", "2"));
Assert.AreEqual(1, Program.Subtract("3", "2"));
Assert.AreEqual(-2, Program.Subtract("5", "7"));
}

[Test]
public void Subtract_Invalid()
public void Subtract_InvalidBernt()
{
Assert.Throws<FormatException>(() => Program.Subtract("1", "a"));
Assert.Throws<FormatException>(() => Program.Subtract("a", "1"));
Assert.Throws<FormatException>(() => Program.Subtract("a", "a"));
}

[Test]
public void Subtract_Null()
public void Subtract_NullBernt()
{
Assert.Throws<ArgumentNullException>(() => Program.Subtract("1", null));
Assert.Throws<ArgumentNullException>(() => Program.Subtract(null, "1"));
Assert.Throws<ArgumentNullException>(() => Program.Subtract(null, null));
}
// Multiply tests
[Test]
public void Multiply_Valid()
public void Multiply_ValidBernt()
{
Assert.AreEqual(2, Program.Multiply("1", "2"));
Assert.AreEqual(6, Program.Multiply("3", "2"));
Assert.AreEqual(35, Program.Multiply("5", "7"));
}

[Test]
public void Multiply_Invalid()
public void Multiply_InvalidBernt()
{
Assert.Throws<FormatException>(() => Program.Multiply("1", "a"));
Assert.Throws<FormatException>(() => Program.Multiply("a", "1"));
Assert.Throws<FormatException>(() => Program.Multiply("a", "a"));
}

[Test]
public void Multiply_Null()
public void Multiply_NullBernt()
{
Assert.Throws<ArgumentNullException>(() => Program.Multiply("1", null));
Assert.Throws<ArgumentNullException>(() => Program.Multiply(null, "1"));
Assert.Throws<ArgumentNullException>(() => Program.Multiply(null, null));
}
// Divide tests
[Test]
public void Divide_Valid()
public void Divide_ValidBernt()
{
Assert.AreEqual(0.5, Program.Divide("1", "2"));
Assert.AreEqual(1.5, Program.Divide("3", "2"));
Assert.AreEqual(20, Program.Divide("100", "5"));
}

[Test]
public void Divide_Invalid()
public void Divide_InvalidBernt()
{
Assert.Throws<FormatException>(() => Program.Divide("1", "a"));
Assert.Throws<FormatException>(() => Program.Divide("a", "1"));
Assert.Throws<FormatException>(() => Program.Divide("a", "a"));
}

[Test]
public void Divide_Null()
public void Divide_NullBernt()
{
Assert.Throws<ArgumentNullException>(() => Program.Divide("1", null));
Assert.Throws<ArgumentNullException>(() => Program.Divide(null, "1"));
Assert.Throws<ArgumentNullException>(() => Program.Divide(null, null));
}
// Power tests
[Test]
public void Power_Valid()
public void Power_ValidBernt()
{
Assert.AreEqual(2, Program.Power("1", "2"));
Assert.AreEqual(1, Program.Power("1", "2"));
Assert.AreEqual(9, Program.Power("3", "2"));
Assert.AreEqual(1024, Program.Power("2", "10"));
}

[Test]
public void Power_Invalid()
public void Power_InvalidBernt()
{
Assert.Throws<FormatException>(() => Program.Power("1", "a"));
Assert.Throws<FormatException>(() => Program.Power("a", "1"));
Assert.Throws<FormatException>(() => Program.Power("a", "a"));
}

[Test]
public void Power_Null()
public void Power_NullBernt()
{
Assert.Throws<ArgumentNullException>(() => Program.Power("1", null));
Assert.Throws<ArgumentNullException>(() => Program.Power(null, "1"));
Expand Down