Пример #1
0
        public static void RemoveAt_Throws_Index_Out_of_Range_Exception_for_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);
            Assert.AreEqual(1, boundary[1].X);
            Assert.AreEqual(2, boundary[1].Y);

            Assert.Throws <IndexOutOfRangeException>(() => boundary.RemoveAt(4));
        }
Пример #2
0
        public static void RemoveAt_Removes_Coordinate_of_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(1, boundary[1].X);
            Assert.AreEqual(2, boundary[1].Y);

            boundary.RemoveAt(1);
            Assert.AreEqual(3, boundary.Count);
            Assert.AreEqual(3, boundary[1].X);
            Assert.AreEqual(4, boundary[1].Y);
        }