Exemplo n.º 1
0
        public void TestReverseMethodWithEmptyInputReturnsEmptyArray()
        {
            // Prepare
            var given = new RequestReverseParameters {
                ProductIds = new int[] { }
            };

            // Perform
            var output = this.arraycalcController.Reverse(given).Value;

            // Assert
            Assert.Equal(output, given.ProductIds);
        }
Exemplo n.º 2
0
        public void TestReverseMethodReverseArrayCorrectly()
        {
            // Prepare
            var given = new RequestReverseParameters {
                ProductIds = new int[] { 1, 2, 3, 4, 5 }
            };
            var expected = new int[] { 5, 4, 3, 2, 1 };

            // Perform
            var output = this.arraycalcController.Reverse(given).Value;

            // Assert
            Assert.NotEqual(given.ProductIds, expected);
            Assert.Equal(output, expected);
        }
Exemplo n.º 3
0
 public ActionResult <IEnumerable <int> > Reverse([FromQuery] RequestReverseParameters query)
 {
     return(arrayOperations
            .Reverse(query.ProductIds)
            .ToArray());
 }