예제 #1
0
        public void TestDeletePartDeletesNothingForOutOfRangePosition(int position)
        {
            // Prepare
            var given = new RequestDeletePartParameters {
                ProductIds = new int[] { 1, 2, 3, 4, 5 },
                Position   = position
            };

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

            // Assert
            Assert.Equal(output, given.ProductIds);
        }
예제 #2
0
        public void TestDeletePartDeletesPartCorrectly()
        {
            // Prepare
            var given = new RequestDeletePartParameters {
                ProductIds = new int[] { 1, 2, 3, 4, 5 },
                Position   = 2
            };

            var expected = new int[] { 1, 3, 4, 5 };

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

            // Assert
            Assert.NotEqual(given.ProductIds, expected);
            Assert.Equal(output, expected);
        }
예제 #3
0
 public ActionResult <IEnumerable <int> > DeletePart([FromQuery] RequestDeletePartParameters query)
 {
     return(arrayOperations
            .DeletePart(query.ProductIds, query.Position)
            .ToArray());
 }