//// BadRequest .. public void GetContratos_Return_BadRequestResultById() { //Arrange var controller = new ContratosController(repository, mapper); int ctrId = 25; //Act var data = controller.GetById(ctrId); //Assert Assert.IsType <BadRequestResult>(data.Result); }
//// NotFound .. public void GetContratos_Return_NotFoundById() { //Arrange var controller = new ContratosController(repository, mapper); int ctrId = 1111; //Act var data = controller.GetById(ctrId); //Assert Assert.IsType <NotFoundResult>(data.Result); }
// OkResult .. public void GetContratos_Return_OkResultById() { //Arrange var controller = new ContratosController(repository, mapper); int ctrId = 7; //Act var data = controller.GetById(ctrId); //Assert Assert.IsType <ContratoDTO>(data.Value); }
// GET retornar lista de objetos contrato .. public void GetContratos_MatchResultById() { //Arrange var controller = new ContratosController(repository, mapper); int ctrId = 7; //Act var data = controller.GetById(ctrId); //Assert Assert.IsType <ContratoDTO>(data.Value); var ctr = data.Value.Should().BeAssignableTo <ContratoDTO>().Subject; Assert.Equal("7", ctr.Id.ToString()); Assert.Equal("22/09/2019 01:00:00", ctr.Data.ToString()); Assert.Equal("12", ctr.QtdeParcelas.ToString()); Assert.Equal("5000,00", ctr.VlrFinanciado.ToString()); }