public async void GetStatusAsync_Post_Success() { // Arrange var helper = new TestHelper(); var controller = helper.CreateController <ChesController>(Permissions.PropertyEdit); var filter = new Model.StatusModel(); var response = new[] { new Model.StatusResponseModel() { TransactionId = Guid.NewGuid(), MessageId = Guid.NewGuid(), CreatedOn = DateTime.UtcNow, Status = "pending", SendOn = DateTime.UtcNow } }; var service = helper.GetService <Mock <IChesService> >(); service.Setup(m => m.GetStatusAsync(It.IsAny <Model.StatusModel>())).ReturnsAsync(response); // Act var result = await controller.GetStatusAsync(filter); // Assert JsonResult actionResult = Assert.IsType <JsonResult>(result); var results = Assert.IsAssignableFrom <IEnumerable <Model.StatusResponseModel> >(actionResult.Value); }
public async Task <IActionResult> GetStatusAsync([FromQuery] Model.StatusModel filter) { var result = await _chesService.GetStatusAsync(filter); return(new JsonResult(result)); }