Skip to content

Commit bdb225d

Browse files
committed
add a NaN test
1 parent f4dca3f commit bdb225d

1 file changed

Lines changed: 33 additions & 1 deletion

File tree

LinqStatisticsTests/RangeTests.cs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
using System.Linq;
55
using Microsoft.VisualStudio.TestTools.UnitTesting;
66

7+
using LinqStatistics.NaN;
8+
79
namespace 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
}

0 commit comments

Comments
 (0)