public void Sistema_Deveria_Buscar_Todos_Os_Livro() { //Arrange Livro resultLivro = _livroService.Add(_livroDefault); //Action IList <Livro> resultGetAll = _livroService.GetAll(); //Assert var ultimaLivro = resultGetAll[resultGetAll.Count - 1]; resultGetAll.Should().NotHaveCount(0); resultGetAll.Should().HaveCount(2); ultimaLivro.Should().Equals(_livroDefault); }
public void LivroService_GetAll_ShouldBeOk() { _mockRepositorio.Setup(m => m.GetAll()).Returns(new List <Livro>()); LivroService service = new LivroService(_mockRepositorio.Object); List <Livro> resultado = service.GetAll() as List <Livro>; resultado.Should().NotBeNull(); _mockRepositorio.Verify(repository => repository.GetAll()); }
public void Test_LivroService_GetAll_Test_Should_BeOk() { _mock.Setup(x => x.GetAll()).Returns(new List <Livro>() { _livro }); var obtido = Alvo.GetAll(); _mock.Verify(x => x.GetAll()); obtido.First().Should().Be(_livro); }
public void GetAll_Deveria_Retornar_Todos_Os_Livros() { //Arrange IList <Livro> _livroDefaultList = LivroObjectMother.DefaultListLivros; _livroRepositoryMockObject.Setup(p => p.GetAll()).Returns(_livroDefaultList); //Action var resultLivros = _livroService.GetAll(); //Assert _livroRepositoryMockObject.Verify(x => x.GetAll()); resultLivros.Should().NotBeEmpty(); resultLivros.Should().HaveCount(3); }
/// <summary> /// Método privado que limpa a lista de vendas e lista novamente /// </summary> private void ListLivros() { listLivros.Items.Clear(); cmbLivro.Items.Clear(); var list = _livroService.GetAll(); foreach (var item in list) { listLivros.Items.Add(item); if (item.Disponibilidade) { cmbLivro.Items.Add(item); } } }