public void TestSame() { Vector2 foo = new Vector2(1.0, 2.0); Vector2 bar = new Vector2(1.0, 2.0); IDifference result = Point2DDifference.Construct("Foo", foo, bar); Assert.IsNull(result); }
public void TestToString() { Vector2 bar = new Vector2(1.0, 5.0); IDifference result = Point2DDifference.Construct("Foo", null, bar); string diffString = result.ToString(); Assert.IsNotNull(diffString); AssertOneLiner(diffString); }
public void TestOneNull() { Vector2 bar = new Vector2(1.0, 2.0); IDifference result = Point2DDifference.Construct("Foo", null, bar); Assert.IsNotNull(result); result = Point2DDifference.Construct("Foo", bar, null); Assert.IsNotNull(result); }
/// <summary> /// Constructs a new <see cref="IDifference"/> object. /// </summary> /// <param name="name">a name reflecting the nature of the created <see cref="IDifference"/></param> /// <param name="first">the first object to compare</param> /// <param name="second">the second object to compare</param> /// <returns>an <see cref="IDifference"/> reflecting the differences between the first and second object</returns> public static IDifference Construct(string name, Vector2?first, Vector2?second) { if (first == null && second == null) { return(null); } var totalDiff = new Point2DDifference(name); totalDiff.AddChild(DoubleDifference.Construct("x", first.HasValue ? (double?)null : first.Value.X, second.HasValue ? (double?)null : second.Value.X)); totalDiff.AddChild(DoubleDifference.Construct("y", first.HasValue ? (double?)null : first.Value.Y, second.HasValue ? (double?)null : second.Value.Y)); if (totalDiff.ChildCount() == 0) { return(null); } return(totalDiff); }
public void TestTwoNull() { IDifference result = Point2DDifference.Construct("Foo", null, null); Assert.IsNull(result); }