@@ -25,22 +25,35 @@ public partial class Test_Guard
25
25
[ DataRow ( - 500 , - 530 , 50u , true ) ]
26
26
[ DataRow ( 1000 , 800 , 200u , true ) ]
27
27
[ DataRow ( int . MaxValue , int . MaxValue - 10 , 10u , true ) ]
28
- public void Test_Guard_IsCloseToInt ( int value , int target , uint delta , bool isClose )
28
+ public void Test_Guard_IsCloseOrNotToInt ( int value , int target , uint delta , bool isClose )
29
29
{
30
30
void Test ( int value , int target )
31
31
{
32
32
bool isFailed = false ;
33
33
34
34
try
35
35
{
36
- Guard . IsCloseTo ( value , target , delta , nameof ( Test_Guard_IsCloseToInt ) ) ;
36
+ Guard . IsCloseTo ( value , target , delta , nameof ( Test_Guard_IsCloseOrNotToInt ) ) ;
37
37
}
38
38
catch ( ArgumentException )
39
39
{
40
40
isFailed = true ;
41
41
}
42
42
43
43
Assert . AreEqual ( isClose , ! isFailed ) ;
44
+
45
+ isFailed = false ;
46
+
47
+ try
48
+ {
49
+ Guard . IsNotCloseTo ( value , target , delta , nameof ( Test_Guard_IsCloseOrNotToInt ) ) ;
50
+ }
51
+ catch ( ArgumentException )
52
+ {
53
+ isFailed = true ;
54
+ }
55
+
56
+ Assert . AreEqual ( isClose , isFailed ) ;
44
57
}
45
58
46
59
Test ( value , target ) ;
@@ -70,14 +83,27 @@ void Test(float value, float target)
70
83
71
84
try
72
85
{
73
- Guard . IsCloseTo ( value , target , delta , nameof ( Test_Guard_IsCloseToInt ) ) ;
86
+ Guard . IsCloseTo ( value , target , delta , nameof ( Test_Guard_IsCloseToFloat ) ) ;
74
87
}
75
88
catch ( ArgumentException )
76
89
{
77
90
isFailed = true ;
78
91
}
79
92
80
93
Assert . AreEqual ( isClose , ! isFailed ) ;
94
+
95
+ isFailed = false ;
96
+
97
+ try
98
+ {
99
+ Guard . IsNotCloseTo ( value , target , delta , nameof ( Test_Guard_IsCloseToFloat ) ) ;
100
+ }
101
+ catch ( ArgumentException )
102
+ {
103
+ isFailed = true ;
104
+ }
105
+
106
+ Assert . AreEqual ( isClose , isFailed ) ;
81
107
}
82
108
83
109
Test ( value , target ) ;
0 commit comments