public void AdicionarTransacaoCorreta() { // Arrange var controller = new TransacoesController(); var novaTransacao = new Transacao { Data = DateTime.Now, PedidoId = 32, UsuarioId = 54, Valor = 342.56m }; // Act var response = controller.Post(novaTransacao).Value as Transacao; // Assert Assert.NotEqual(0, response.Id); }
public void AdicionarTransacaoInvalida() { // Arrange var controller = new TransacoesController(); var novaTransacao = new Transacao { Data = DateTime.Now, UsuarioId = 54, Valor = 342.56m }; // Act var response = controller.Post(novaTransacao).Result as BadRequestResult; var expected = (int)HttpStatusCode.BadRequest; // Assert Assert.NotNull(response); Assert.Equal(expected, response.StatusCode); }