コード例 #1
0
        public async Task <ActionResult <int[]> > DeletePartialElement(
            int position,
            [FromQuery(Name = "productIds")] int[] productIds)
        {
            var result = await _arrayCalculationService.DeletePartialElement(position, productIds);

            return(Ok(result));
        }
コード例 #2
0
        public async Task WhenArrayCalculationServiceDeletePartialElementReturnsValueThenResultIsOk()
        {
            var array = new [] { 1 };

            _arrayCalculationService
            .DeletePartialElement(Arg.Any <int>(), Arg.Any <int[]>())
            .Returns(array);

            var result = await _arrayCalculationController.DeletePartialElement(0, null);

            result.Result.Should().BeOfType <OkObjectResult>();
        }
コード例 #3
0
 public async Task WhenInputArrayIsNullThenDeletePartialElementThrowsInvalidOperationException()
 {
     await Assert.ThrowsAsync <ArgumentNullException>(
         async() => await _arrayCalculationService.DeletePartialElement(0, null));
 }