public void TestMapInverseWithNullValue() { var map = new DateTimeToSizeMap(DateTime.MinValue, DateTime.MaxValue, 0d, 1d, SortOrder.Ascending); var result = map.MapInverse(null); Assert.That(result, Is.Null); }
public void TestMapInverseReturnsNullWhenResultIsNotANumber() { var map = new DateTimeToSizeMap(DateTime.MinValue, DateTime.MaxValue, 0d, 0d, SortOrder.Ascending); var result = map.MapInverse(0d); Assert.That(result, Is.Null); }
public void TestMapInverseWithOutOfRangeValues(double value, string expected) { var map = new DateTimeToSizeMap(DateTime.MinValue, DateTime.MaxValue, 0d, 1d, SortOrder.Ascending); var expectedDate = DateTime.Parse(expected); var result = map.MapInverse(value); Assert.That(result, Is.EqualTo(expectedDate).Within(TimeSpan.FromMilliseconds(1))); }
public void TestMapWithDescendingValues(string date, double expected) { var map = new DateTimeToSizeMap(DateTime.MinValue, DateTime.MaxValue, 0d, 1d, SortOrder.Descending); var value = DateTime.Parse(date); var result = map.Map(value); Assert.That(result, Is.EqualTo(expected).Within(0.0001)); }
public void TestMapWithMillisecondValues(string time, double expected) { var min = DateTime.Parse("1/1/0001 00:00:00.000"); var max = DateTime.Parse("1/1/0001 00:00:01.000"); var map = new DateTimeToSizeMap(min, max, 0d, 1d, SortOrder.Ascending); var value = DateTime.Parse(time); var result = map.Map(value); Assert.That(result, Is.EqualTo(expected).Within(0.0001)); }
public void TestMapInverseWithMillisecondValues(double value, string expected) { var min = DateTime.Parse("1/1/0001 00:00:00.000"); var max = DateTime.Parse("1/1/0001 00:00:01.000"); var map = new DateTimeToSizeMap(min, max, 0d, 1d, SortOrder.Ascending); var expectedDate = DateTime.Parse(expected); var result = map.MapInverse(value); Assert.That(result, Is.EqualTo(expectedDate)); }