This repository has been archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathWeighingMachineTests.cs
81 lines (72 loc) · 2.39 KB
/
WeighingMachineTests.cs
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
73
74
75
76
77
78
79
80
81
using System;
using Xunit;
public class WeighingMachineTests
{
[Fact]
public void Set_weight_and_get_weight()
{
var wm = new WeighingMachine();
wm.InputWeight = 60m;
Assert.Equal(60m, wm.InputWeight, precision: 3);
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Negative_weight_is_invalid()
{
var wm = new WeighingMachine();
Assert.Throws<ArgumentException>(() => wm.InputWeight = -10);
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Get_us_display_weight_pounds()
{
var wm = new WeighingMachine();
wm.InputWeight = 60m;
Assert.Equal(132, wm.USDisplayWeight.Pounds);
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Get_us_display_weight_ounces()
{
var wm = new WeighingMachine();
wm.InputWeight = 60m;
Assert.Equal(4, wm.USDisplayWeight.Ounces);
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Input_pounds_and_get_us_display_weight_pounds()
{
var wm = new WeighingMachine();
wm.Units = Units.Pounds;
wm.InputWeight = 175.5m;
Assert.Equal(175, wm.USDisplayWeight.Pounds);
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Input_pounds_and_get_is_display_weight_ounces()
{
var wm = new WeighingMachine();
wm.Units = Units.Pounds;
wm.InputWeight = 175.5m;
Assert.Equal(8, wm.USDisplayWeight.Ounces);
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Apply_tare_adjustment_and_get_display_weight()
{
var wm = new WeighingMachine();
wm.InputWeight = 100;
wm.TareAdjustment = 10;
Assert.Equal(90, wm.DisplayWeight);
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Apply_negative_tare_adjustment()
{
var wm = new WeighingMachine();
wm.InputWeight = 100;
wm.TareAdjustment = -10;
Assert.Equal(110, wm.DisplayWeight);
}
[Fact(Skip = "Remove this Skip property to run this test")]
public void Apply_large_tare_adjustment_to_allow_negative_display_weight()
{
var wm = new WeighingMachine();
wm.InputWeight = 100;
wm.TareAdjustment = 110;
Assert.Equal(-10, wm.DisplayWeight);
}
}