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); }
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); }
public ActionResult <IEnumerable <int> > DeletePart([FromQuery] RequestDeletePartParameters query) { return(arrayOperations .DeletePart(query.ProductIds, query.Position) .ToArray()); }