public void AoAcessarACamdadaDeAcessoADadosParaAlterarUmProduto_OProdutoDeveSerSalvoEUmResultadoBooleYearDeveSerRetornado() { var novosValores = new Product { ProductId = 3, Name = "Cinderela", Author = "Popular", Publishing = "Abril", Year = 2005, Category = Categories.InfantoJuvenis, Stock = 10, Price = 10.0M, Photo = "" }; var mockContext = new LivrariaTDDContext(); novosValores = mockContext.Products.Add(novosValores); mockContext.SaveChanges(); //mockContext.Setup(x => x.Produtos).Returns(_listaDeProdutos); _repository = new ProdutoRepository(mockContext); var aux = _repository.RecuperarInformacoesDoLivro(novosValores.ProductId); var livroAntigo = new Product { ProductId = aux.ProductId, Name = aux.Name, Author = aux.Author, Publishing = aux.Publishing, Year = aux.Year, Category = aux.Category, Stock = aux.Stock, Price = aux.Price, Photo = aux.Photo }; novosValores.Name = "Name novo"; var result = _repository.AlterarLivro(novosValores); var livroNovo = _repository.RecuperarInformacoesDoLivro(novosValores.ProductId); Assert.True(result); Assert.AreEqual(livroAntigo.ProductId, livroNovo.ProductId); StringAssert.AreNotEqualIgnoringCase(livroAntigo.Name, livroNovo.Name); }