Repository navigation
Expand file tree
/
Copy pathTestBasicMath.cs
More file actions
72 lines (60 loc) · 1.74 KB
/
Copy pathTestBasicMath.cs
File metadata and controls
72 lines (60 loc) · 1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using System;
using System.Collections.Generic;
using System.Text;
using Xunit;
using Calculator;
namespace TestCalculator
{
public class TestBasicMath
{
[Theory]
[InlineData(4, 0, 0)]
[InlineData(0, 4, 0)]
[InlineData(10, 5, 2)]
public void DivideNumbers(double a, double b, double expected)
{
/// action
BasicMath cal1 = new BasicMath();
double actual = cal1.Division(a, b);
/// assertion
Assert.Equal(expected, actual);
}
[Fact]
public void SubtractNumbers()
{
// arrange
double expected = 2;
// action
BasicMath cal1 = new BasicMath();
double actual = cal1.Subtract(5, 3);
// assertion
Assert.Equal(expected, actual);
}
[Theory]
[InlineData(4, 3, 7)]
[InlineData(4.4, 5.6, 10.0)]
[InlineData(double.MaxValue, 5.6, double.MaxValue)]
[InlineData(-4.4, -5.6, -10.0)]
[InlineData(0, 0, 0)]
public void AddNumbers(double a, double b, double expected)
{
// action
BasicMath cal1 = new BasicMath();
double actual = cal1.Add(a, b);
// assertion
Assert.Equal(expected, actual);
//Assert.Eq
}
[Fact]
public void DivideByZero()
{
//arrange
double expected = 0;
// action
BasicMath cal1 = new BasicMath();
double actual = cal1.Division(15, 0);
// assertion
Assert.Equal(expected, actual);
}
}
}