Ejemplo n.º 1
0
        public async Task CreatePedido_Should_Return_Ok()
        {
            //Arrange
            var request = await PedidoBuilder.CreatePedidoClienteCadastradoRequest();

            var uri = $"{URL}/create";

            //Act
            var response = await _client.PostAsync(uri, ContentHelper.GetStringContent(request));

            // Assert
            response.EnsureSuccessStatusCode();
        }
Ejemplo n.º 2
0
        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}");
        }