public static void ReplaceAt_Throws_Index_Out_of_Range_Exception_for_Coordinate_at_Out_of_Range_Index() { List <CartesianCoordinate> coordinates = new List <CartesianCoordinate>() { new CartesianCoordinate(0, 0), new CartesianCoordinate(1, 2), new CartesianCoordinate(3, 4), new CartesianCoordinate(5, 6) }; PointBoundary boundary = new PointBoundary(coordinates); Assert.AreEqual(4, boundary.Count); CartesianCoordinate newCoordinate = new CartesianCoordinate(7, 8); Assert.Throws <IndexOutOfRangeException>(() => boundary.ReplaceAt(4, newCoordinate)); }
public static void ReplaceAt_Replaces_Coordinate_at_Specified_Index() { List <CartesianCoordinate> coordinates = new List <CartesianCoordinate>() { new CartesianCoordinate(0, 0), new CartesianCoordinate(1, 2), new CartesianCoordinate(3, 4), new CartesianCoordinate(5, 6) }; PointBoundary boundary = new PointBoundary(coordinates); Assert.AreEqual(4, boundary.Count); Assert.AreEqual(3, boundary[2].X); Assert.AreEqual(4, boundary[2].Y); CartesianCoordinate newCoordinate = new CartesianCoordinate(7, 8); boundary.ReplaceAt(2, newCoordinate); Assert.AreEqual(4, boundary.Count); Assert.AreEqual(newCoordinate.X, boundary[2].X); Assert.AreEqual(newCoordinate.Y, boundary[2].Y); }