// GET retornar lista de objetos contrato .. public void GetContratos_MatchResult() { //Arrange var controller = new ContratosController(repository, mapper); //Act var data = controller.Get(); //Assert Assert.IsType <List <ContratoDTO> >(data.Value); var ctr = data.Value.Should().BeAssignableTo <List <ContratoDTO> >().Subject; Assert.Equal("1", ctr[0].Id.ToString()); Assert.Equal("10/10/2019 00:00:00", ctr[0].Data.ToString()); Assert.Equal("3", ctr[0].QtdeParcelas.ToString()); Assert.Equal("6000,00", ctr[0].VlrFinanciado.ToString()); Assert.Equal("4", ctr[1].Id.ToString()); Assert.Equal("15/12/2019 01:00:00", ctr[1].Data.ToString()); Assert.Equal("20", ctr[1].QtdeParcelas.ToString()); Assert.Equal("88000,00", ctr[1].VlrFinanciado.ToString()); Assert.Equal("6", ctr[2].Id.ToString()); Assert.Equal("15/12/2019 01:00:00", ctr[2].Data.ToString()); Assert.Equal("20", ctr[2].QtdeParcelas.ToString()); Assert.Equal("77000,00", ctr[2].VlrFinanciado.ToString()); }
// BadRequest .. public void GetContratos_Return_BadRequestResult() { //Arrange var controller = new ContratosController(repository, mapper); //Act var data = controller.Get(); //Assert Assert.IsType <BadRequestResult>(data.Result); }
// OkResult .. public void GetContratos_Return_OkResult() { //Arrange var controller = new ContratosController(repository, mapper); //Act var data = controller.Get(); //Assert Assert.IsType <List <ContratoDTO> >(data.Value); }