public void Rotate_WhenInputArrayIsNull_ThrowArgumentNullException()
        {
            //Arrange
            ArrayRotation arrayRotation = new ArrayRotation();

            //Act
            var output = arrayRotation.Rotate(null, 2);

            //Assert
        }
        public void Rotate_WhenInputNumberIsEqualToArrayLength_ThrowsArgumentOutOfRangeException()
        {
            //Arrange
            ArrayRotation arrayRotation = new ArrayRotation();

            int[] inputArray = new int[5] {
                1, 2, 3, 4, 5
            };

            //Act
            var output = arrayRotation.Rotate(inputArray, inputArray.Length);
        }
Example #3
0
        static void Main(string[] args)
        {
            ArrayRotation arrayRotation = new ArrayRotation();

            int[] inputArray = new int[5] {
                1, 2, 3, 4, 5
            };
            int[] outputArray = arrayRotation.Rotate(inputArray, 2);

            for (int i = 0; i < outputArray.Length; i++)
            {
                Console.Write(outputArray[i].ToString());
                Console.Write("  ");
            }

            Console.ReadKey();
        }
        public void Rotate_WhenValidArrayAndNumberPassed_RotatesArray()
        {
            //Arrange
            ArrayRotation arrayRotation = new ArrayRotation();

            int[] inputArray = new int[5] {
                1, 2, 3, 4, 5
            };
            int[] expectedArray = new int[5] {
                3, 4, 5, 1, 2
            };

            //Act
            var output = arrayRotation.Rotate(inputArray, 2);

            //Assert
            Assert.IsTrue(expectedArray.IsArrayEqual(output));
        }