public void AoAcessarACamadaDeNegociosDaPaginaDeListagemEOcorreUmaExcecao_AExcecaoDeveSerLancadaParaCamadaSuperior() { var repository = new Mock<IProductRepository>(); repository.Setup(x => x.RecuperarTodosProdutos()).Throws<Exception>(); var business = new ProductBusiness(repository.Object); Assert.Throws<Exception>(() => business.GetAll()); }
public void AoAcessarACamadaDeNegociosDaPaginaDeVisualizacaoEOcorrerUmaExcecao_AExcecaoDeveSerLancadaParaCamadaSuperior() { const int id = 1; var repository = new Mock<IProductRepository>(); repository.Setup(x => x.RecuperarInformacoesDoLivro(id)).Throws<Exception>(); var business = new ProductBusiness(repository.Object); Assert.Throws<Exception>(() => business.GetInfo(id)); }
public void SetUp() { _repository = new Mock<IProductRepository>(); _business = new ProductBusiness(_repository.Object); }