public static void Test_Wrong() { PointStruct p = new PointStruct(5, 10); Contract.Assert(p.X == 5); Contract.Assert(p.SquareDistance == 125); p.Move(2); Contract.Assert(p.X == 5); // False Contract.Assert(p.Y == 11); // Unreached }
public static void Test_OK() { PointStruct p = new PointStruct(5, 10); Contract.Assert(p.X == 5); Contract.Assert(p.SquareDistance == 125); p.Move(2); Contract.Assert(p.X == 7); Contract.Assert(p.Y == 12); }