示例#1
0
        public void Aluno_Sistema_Aplicacao_PegarTodos_NaoDeveJogarExcecao()
        {
            aluno = ObjectMother.ObterAlunoValido();
            aluno = servico.Salvar(aluno);

            var alunos = servico.PegarTodos();

            alunos.Last().Id.Should().Be(aluno.Id);
        }
示例#2
0
        public void Aluno_Aplicacao_PegarTodos_NaoDeveJogarExcecao()
        {
            var id = 1;

            repositorio.Setup(ar => ar.PegarTodos()).Returns(new List <Aluno> {
                new Aluno {
                    Id = id
                }
            });

            var alunos = servico.PegarTodos();

            alunos.First().Id.Should().Be(id);
            repositorio.Verify(ar => ar.PegarTodos());
            repositorio.VerifyNoOtherCalls();
        }
示例#3
0
        public void Aluno_Servico_PegarTodos_DevePegarTodosOk()
        {
            aluno = ObjectMother.ObterAlunoValido();
            repositorio.Setup(m => m.Salvar(aluno)).Returns(new Aluno {
                Id = 1
            });
            repositorio.Setup(m => m.PegarTodos()).Returns(new List <Aluno>());
            aluno = servico.Salvar(aluno);

            IList <Aluno> alunos = servico.PegarTodos();

            alunos.Count.Should().BeGreaterThan(0);
            alunos.Last().Id.Should().Be(aluno.Id);
            repositorio.Verify(m => m.PegarTodos());
            repositorio.Verify(m => m.Salvar(aluno));
            repositorio.VerifyNoOtherCalls();
        }