public void WhenComparingSmaller_ReturnsPostive() { //Prepare Node a = new Node { Distance = 1, X = 1, Y = 1 }; Node b = new Node { Distance = 1, X = 2, Y = 2 }; Node c = new Node { Distance = 1, X = 1, Y = 1 }; Node d = new Node { Distance = 2, X = 1, Y = 1 }; Node goal = new Node { X = 5, Y = 5 }; DirectedDistanceComparer<Node> target = new DirectedDistanceComparer<Node>(goal); //Act int result1 = target.Compare(a, b); int result2 = target.Compare(d, c); //Verify Assert.IsTrue(result1 > 0); Assert.IsTrue(result2 > 0); }
public void WhenComparingEqual_ReturnsZero() { //Prepare Node a = new Node { Distance = 1, X = 1, Y = 1 }; Node b = new Node { Distance = 1, X = 1, Y = 1 }; Node goal = new Node { X = 5, Y = 5 }; DirectedDistanceComparer<Node> target = new DirectedDistanceComparer<Node>(goal); //Act int result = target.Compare(a, b); //Verify Assert.AreEqual(0, result); }