public void CompareTo_ShouldReturnPositive_GivenLowerIsPositiveToNegativeInfinity() { var upper = EndPoint <int> .NegativeInfinity; var lower = new EndPoint <int>(6); Assert.That(lower.CompareTo(upper), Is.EqualTo(1)); }
public void CompareTo_DifferentSmallerAndLargerEndpointValues_Returns_Minus_1( bool includeFirstIntervalEdge, bool includeSecondIntervalEdge, EndPointType firstEndPointType, EndPointType secondEndPointType, int expectedResult) { //Arrange var endPoint1 = new EndPoint<DateTime>(new Interval<DateTime>(now, inOneHour, firstEndPointType != EndPointType.Min || includeFirstIntervalEdge, firstEndPointType != EndPointType.Max || includeFirstIntervalEdge), firstEndPointType); var endPoint2 = new EndPoint<DateTime>(new Interval<DateTime>(inTwoHours, inThreeHours, secondEndPointType != EndPointType.Min || includeSecondIntervalEdge, secondEndPointType != EndPointType.Max || includeSecondIntervalEdge), secondEndPointType); //Act int compareResult = endPoint1.CompareTo(endPoint2); //Assert Assert.AreEqual(expectedResult, compareResult); }
public void CompareTo_DifferentSmallerAndLargerEndpointValues_Returns_Minus_1( bool includeFirstIntervalEdge, bool includeSecondIntervalEdge, EndPointType firstEndPointType, EndPointType secondEndPointType, int expectedResult) { //Arrange var endPoint1 = new EndPoint <DateTime>(new Interval <DateTime>(now, inOneHour, firstEndPointType != EndPointType.Min || includeFirstIntervalEdge, firstEndPointType != EndPointType.Max || includeFirstIntervalEdge), firstEndPointType); var endPoint2 = new EndPoint <DateTime>(new Interval <DateTime>(inTwoHours, inThreeHours, secondEndPointType != EndPointType.Min || includeSecondIntervalEdge, secondEndPointType != EndPointType.Max || includeSecondIntervalEdge), secondEndPointType); //Act int compareResult = endPoint1.CompareTo(endPoint2); //Assert Assert.AreEqual(expectedResult, compareResult); }
public void CompareTo_TheSameEndpointValue_ReturnsCorrectExpectedResult( bool includeFirstIntervalEdge, bool includeSecondIntervalEdge, EndPointType firstEndPointType, EndPointType secondEndPointType, int expectedResult) { //Arrange // use 0 length intervals here for easier testing var endPoint1 = new EndPoint <DateTime>(new Interval <DateTime>(now, now, firstEndPointType != EndPointType.Min || includeFirstIntervalEdge, firstEndPointType != EndPointType.Max || includeFirstIntervalEdge), firstEndPointType); var endPoint2 = new EndPoint <DateTime>(new Interval <DateTime>(now, now, secondEndPointType != EndPointType.Min || includeSecondIntervalEdge, secondEndPointType != EndPointType.Max || includeSecondIntervalEdge), secondEndPointType); //Act int compareResult = endPoint1.CompareTo(endPoint2); //Assert Assert.AreEqual(expectedResult, compareResult); }
public void CompareTo_TheSameEndpointValue_ReturnsCorrectExpectedResult( bool includeFirstIntervalEdge, bool includeSecondIntervalEdge, EndPointType firstEndPointType, EndPointType secondEndPointType, int expectedResult) { //Arrange // use 0 length intervals here for easier testing var endPoint1 = new EndPoint<DateTime>(new Interval<DateTime>(now, now, firstEndPointType != EndPointType.Min || includeFirstIntervalEdge, firstEndPointType != EndPointType.Max || includeFirstIntervalEdge), firstEndPointType); var endPoint2 = new EndPoint<DateTime>(new Interval<DateTime>(now, now, secondEndPointType != EndPointType.Min || includeSecondIntervalEdge, secondEndPointType != EndPointType.Max || includeSecondIntervalEdge), secondEndPointType); //Act int compareResult = endPoint1.CompareTo(endPoint2); //Assert Assert.AreEqual(expectedResult, compareResult); }
public void CompareTo_ShouldReturnCorrectOrder(EndPoint <int> first, EndPoint <int> second, int expected) { var result = first.CompareTo(second); Assert.That(result, Is.EqualTo(expected)); }
public int CompareTo_ShouldReturnCorrectOrder(int value, int compareTo) { var endPoint = new EndPoint <int>(value); return(endPoint.CompareTo(compareTo)); }