public async void VerifyAddBatch() { AddBatchRequestBody request = new AddBatchRequestBody(); request.ProductId = testBatch1.ProductId; request.BatchSize = testBatch1.BatchSize; request.ExpirationDate = testBatch1.Expiration; mockAccessService.Setup( a => a.AddBatch( request.ProductId, request.BatchSize, request.ExpirationDate ) ).ReturnsAsync(testBatch1); ActionResult actionResult = await this.controller.AddBatch(request); OkObjectResult objResult = Assert.IsType <OkObjectResult>(actionResult); Assert.Equal(200, objResult.StatusCode); mockAccessService.Verify(a => a.AddBatch( request.ProductId, request.BatchSize, request.ExpirationDate ), Times.Once); }
public async Task <ActionResult> AddBatch( [FromBody] AddBatchRequestBody requestBody ) { Batch newBatch = await AccessService.AddBatch( requestBody.ProductId, requestBody.BatchSize, requestBody.ExpirationDate ); return(Ok(newBatch)); }