public void RemoverErroNullReference() { var item = new Veiculo { Id = 1, Chassi = "99999999999999999", TipoVeiculo = TipoVeiculo.Caminhao, Cor = "Branco" }; var moq = new Mock <IVeiculoRepositorio>(); var app = new VeiculoAplicacao(moq.Object); moq.Setup(x => x.ListarPorId(item.Id)).Returns(It.IsAny <Veiculo>()); app.Remover(item.Id); Assert.Fail(); }
public void Remover() { var item = new Veiculo { Id = 1, Chassi = "99999999999999999", TipoVeiculo = TipoVeiculo.Caminhao, Cor = "Branco" }; var moq = new Mock <IVeiculoRepositorio>(); var app = new VeiculoAplicacao(moq.Object); moq.Setup(x => x.ListarPorId(item.Id)).Returns(item); app.Remover(item.Id); moq.Verify(x => x.Remover( It.Is <Veiculo>(v => v.Id == item.Id))); }