public async Task CreateItemPedido_Maior10_Should_Return_Invalid() { //Arrange var request = await ItemPedidoBuilder.CreateItemPedidoRequest(); var uri = $"{URL}/create"; //Act var response = await _client.PostAsync(uri, ContentHelper.GetStringContent(request)); // Assert response.EnsureSuccessStatusCode(); }
public async Task CreateItemPedido_Should_Return_Ok() { //Arrange var request = await ItemPedidoBuilder.CreateItemPedidoRequest(); var response = Task.Run(() => new CreateItemPedidoResponse()); //Act response.Result.SetSucess(true); _mock.Setup(x => x.Create(request)).Returns(response); var result = await _controller.Create(request) as OkResult; //Assert _mock.Verify(x => x.Create(It.IsAny <CreateItemPedidoRequest>()), Times.Once); result.Should().NotBeNull("Return is null"); result.Should().BeOfType <OkResult>("Return type is not valid."); result.StatusCode.Should().Be(200, $"Status Code {result.StatusCode}"); }