File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44using System . Linq ;
55using Microsoft . VisualStudio . TestTools . UnitTesting ;
66
7+ using LinqStatistics . NaN ;
8+
79namespace LinqStatistics . UnitTests
810{
911 /// <summary>
@@ -48,7 +50,26 @@ public void Range()
4850
4951 int result = source . Range ( ) ;
5052
51- Assert . AreEqual ( 4 , result ) ;
53+ Assert . AreEqual ( 4 , result ) ;
54+ }
55+
56+ [ TestMethod ]
57+ [ ExpectedException ( typeof ( InvalidOperationException ) ) ]
58+ public void RangeEmptyExcepts ( )
59+ {
60+ var source = new List < double > ( ) ;
61+
62+ var result = source . Range ( ) ;
63+ }
64+
65+ [ TestMethod ]
66+ public void RangeNaN ( )
67+ {
68+ var source = new List < double > ( ) ;
69+
70+ var result = source . RangeNaN ( ) ;
71+
72+ Assert . IsTrue ( double . IsNaN ( result ) ) ;
5273 }
5374
5475 [ TestMethod ]
@@ -70,5 +91,16 @@ public void MinMaxNoElements()
7091
7192 var result = source . MinMax ( ) ;
7293 }
94+
95+ [ TestMethod ]
96+ public void MinMaxNoElementsNaN ( )
97+ {
98+ IEnumerable < double > source = new List < double > ( ) ;
99+
100+ var result = source . MinMaxNaN ( ) ;
101+
102+ Assert . IsTrue ( double . IsNaN ( result . Max ) ) ;
103+ Assert . IsTrue ( double . IsNaN ( result . Min ) ) ;
104+ }
73105 }
74106}
You can’t perform that action at this time.
0 commit comments