public void TestRotate5()
        {
            //Test rotating -270deg is the same as rotating +90 deg
            int[] rows = { 1, 2, 4 };
            int[] cols = { 2, 7, 11 };
            int width = 20;
            int height = 5;

            Segmentation s90 = new Segmentation((int[])rows.Clone(), (int[])cols.Clone(), width, height); //Deep copy the arrays so the segmentations have different copies
            Segmentation sMinus270 = new Segmentation(rows, cols, width, height);

            s90.Rotate(90);
            sMinus270.Rotate(-270);

            CollectionAssert.AreEqual(s90.Rows, sMinus270.Rows);
            CollectionAssert.AreEqual(s90.Cols, sMinus270.Cols);
            Assert.AreEqual(s90.Width, sMinus270.Width);
            Assert.AreEqual(s90.Height, sMinus270.Height);
        }
        public void TestRotate4()
        {
            //Test rotating 180 deg
            int[] rows = { 1, 2, 4 };
            int[] cols = { 2, 7, 11 };
            int width = 25;
            int height = 15;

            Segmentation s = new Segmentation(rows, cols, width, height);

            int[] expectedRows = { 10, 12, 13 };
            int[] expectedCols = { 13, 17, 22 };
            int expectedWidth = 25;
            int expectedHeight = 15;

            s.Rotate(180);

            CollectionAssert.AreEqual(expectedRows, s.Rows);
            CollectionAssert.AreEqual(expectedCols, s.Cols);
            Assert.AreEqual(expectedWidth, s.Width);
            Assert.AreEqual(expectedHeight, s.Height);
        }
        public void TestRotate2()
        {
            //Check a rotation returns back to itself when rotated 360 deg
            int[] rows = { 324, 563463, 43543212 };
            int[] cols = { 5 };

            int width = 6;
            int height = int.MaxValue;

            Segmentation s = new Segmentation(rows, cols, width, height);

            s.Rotate(360);

            int[] expectedRows = { 324, 563463, 43543212 };
            int[] expectedCols = { 5 };
            int expectedWidth = 6;
            int expectedHeight = int.MaxValue;

            CollectionAssert.AreEqual(expectedRows, rows);
            CollectionAssert.AreEqual(expectedCols, cols);
            Assert.AreEqual(expectedWidth, s.Width);
            Assert.AreEqual(expectedHeight, s.Height);
        }
        public void TestRotate3()
        {
            //Check that rotations can only take place around 90 degrees
            Segmentation s = new Segmentation(10, 10, 20, 20);

            try
            {
                s.Rotate(5);
                //No Exception: Fail
                Assert.Fail();
            }
            catch(ArgumentException)
            {
                //Correct exception: Pass
            }
            catch(Exception)
            {
                //Wrong type of exception: Fail
                Assert.Fail();
            }
        }
        public void TestRotate1()
        {
            //Basic test - gives expected output for a rotation through 90 degrees
            int[] rows = { 1, 2, 4 };
            int[] cols = { 2, 7, 11 };
            int width = 20;
            int height = 5;

            Segmentation s = new Segmentation(rows, cols, width, height);

            int[] expectedRows = { 2, 7, 11 };
            int[] expectedCols = { 0, 2, 3 };
            int expectedWidth = 5;
            int expectedHeight = 20;

            s.Rotate(90);

            CollectionAssert.AreEqual(expectedRows, s.Rows);
            CollectionAssert.AreEqual(expectedCols, s.Cols);
            Assert.AreEqual(expectedWidth, s.Width);
            Assert.AreEqual(expectedHeight, s.Height);
        }