public void BinIdTest() { Histogram rTest1 = new Histogram(20, 1); // Values fall to the right into bins: binLeft <= val < binRight Assert.AreEqual(rTest1.BinId(-10.1), -1); Assert.AreEqual(rTest1.BinId(-10), 0); Assert.AreEqual(rTest1.BinId(-9.999), 0); Assert.AreEqual(rTest1.BinId(-5.1), 4); Assert.AreEqual(rTest1.BinId(-5), 5); Assert.AreEqual(rTest1.BinId(-4.9), 5); Assert.AreEqual(rTest1.BinId(-0.1), 9); Assert.AreEqual(rTest1.BinId(0), 10); Assert.AreEqual(rTest1.BinId(0.1), 10); Assert.AreEqual(rTest1.BinId(10.1), -1); Assert.AreEqual(rTest1.BinId(10), 19); Assert.AreEqual(rTest1.BinId(9.999), 19); // Special case Histogram rTest2 = new Histogram(1, decimal.MaxValue); Assert.AreEqual(rTest2.BinId(10.1), 1); Assert.AreEqual(rTest2.BinId(100000.1), 1); Assert.AreEqual(rTest2.BinId(-10.1), 0); Assert.AreEqual(rTest2.BinId(-100000.1), 0); }