public ActionResult CreateTest01([PexAssumeUnderTest] PedidoController target, tbPedido tbPedido) { ActionResult result = target.Create(tbPedido); return(result); // TODO: agregar aserciones a método PedidoControllerTest.CreateTest01(PedidoController, tbPedido) }
public async Task CreatePedidoClienteCadastrado_Should_Return_Ok() { //Arrange var request = await PedidoBuilder.CreatePedidoClienteCadastradoRequest(); var response = Task.Run(() => new CreatePedidoResponse()); //Act response.Result.SetSucess(true); response.Result.CodPedido = "CP00000-01"; _mock.Setup(x => x.Create(request)).Returns(response); var result = await _controller.Create(request) as OkObjectResult; //Assert _mock.Verify(x => x.Create(It.IsAny <CreatePedidoRequest>()), Times.Once); result.Should().NotBeNull("Return is null"); result.Should().BeOfType <OkObjectResult>("Return type is not valid."); result.StatusCode.Should().Be(200, $"Status Code {result.StatusCode}"); }