예제 #1
0
        public void Deve_informar_que_nao_existem_salas_disponiveis()
        {
            var salas          = new List <Sala>();
            var salaRepository = new SalaRepository(salas);
            var salaService    = new SalaService(salaRepository);

            var exception = Assert.Throws <ChatException>(() => salaService.Obter());

            Assert.Equal("Desculpe, não existem salas disponiveis.", exception.Message);
        }
예제 #2
0
        public void SalaIntegracaoSistema_Adicionar_DeveSerValido()
        {
            //Cenário
            Sala sala = ObjectMother.ObterSalaValida();

            sala.Id = 0;

            //Ação
            Sala salaResultado = _salaService.Adicionar(sala);

            //Verificar
            salaResultado.Should().NotBeNull();
            salaResultado.Id.Should().BeGreaterThan(0);
            salaResultado.Nome.Should().Be(sala.Nome);
            salaResultado.Lugar.Should().Be(sala.Lugar);

            Sala salaGet = _salaService.Obter(salaResultado.Id);

            salaResultado.Id.Should().Be(salaGet.Id);

            _salaService.Excluir(salaResultado);
        }
예제 #3
0
        public void Deve_obter_as_salas_disponiveis()
        {
            var salas = new List <Sala> {
                new Sala("Sala1"), new Sala("Sala2")
            };
            var salaRepository = new SalaRepository(salas);
            var salaService    = new SalaService(salaRepository);

            var salasEncontradas = salaService.Obter();

            Assert.Equal(2, salasEncontradas.Count);
            Assert.Contains(salasEncontradas, x => x.Nome == "Sala1");
            Assert.Contains(salasEncontradas, x => x.Nome == "Sala2");
        }
예제 #4
0
        public void SalaService_Obter_DeveSerValido()
        {
            //Cenário
            Sala sala = ObjectMother.ObterSalaValida();

            sala.Id = 1;

            _mockSalaRepositorio.Setup(rp => rp.Obter(sala.Id)).Returns(new Sala {
                Id = 1, Nome = "nome sala", Lugar = 2
            });

            //Ação
            Sala retorno = _salaService.Obter(sala.Id);

            //Verificar
            _mockSalaRepositorio.Verify(rp => rp.Obter(sala.Id));

            retorno.Should().NotBeNull();
            retorno.Id.Should().BeGreaterThan(0);
        }