public void ShuffleTheArray_GivenExample_ShouldReturnExpected(int[] input, int n, int[] expected)
        {
            // Given
            // When
            _stopwatch.Start();
            var result = _sut.Shuffle(input, n);

            _stopwatch.Stop();
            // Then
            result.Should().BeEquivalentTo(expected);
            Console.WriteLine($"Ran for: {_stopwatch.Elapsed.Milliseconds} ms");
            Console.WriteLine($"Ran for: {_stopwatch.Elapsed.Ticks} ticks");
        }
Example #2
0
        public void Shuffle_WhenCalledWithLCExample3_ReturnsTheCorrectResult()
        {
            // Arrange
            ShuffleTheArray ShuffleTheArray = new ShuffleTheArray();

            int[] nums = { 1, 1, 2, 2 };
            int   n    = 2;

            int[] expected = { 1, 2, 1, 2 };

            // Act
            int[] actual = ShuffleTheArray.Shuffle(nums, n);

            // Assert
            CollectionAssert.AreEqual(expected, actual);
        }