예제 #1
0
        public void Sistema_Deveria_Salvar_Um_Novo_Reuniao_E_Retornar_Do_Banco()
        {
            //Action-Arrange
            Reuniao resultReuniao = _reuniaoService.Alocacao(_reuniaoDefault);

            //Assert
            resultReuniao.Should().NotBeNull();
            resultReuniao.Id.Should().NotBe(0);

            Reuniao resultGet = _reuniaoService.Get(resultReuniao.Id);

            resultGet.Should().NotBeNull();
            resultGet.Should().Equals(resultReuniao);
        }
        public void Alocacao_Deveria_incluir_Nova_Reuniao()
        {
            //Arrange
            List <Reuniao> reunioesSala = ReuniaoObjectMother.DefaultList;

            _reuniaoRepositoryMockObject.Setup(p => p.GetReuniaoBySalaId(It.IsAny <long>())).Returns(reunioesSala);
            _salaFake.Setup(s => s.ConsultarDisponibilidadeSala(It.IsAny <List <Reuniao> >(), It.IsAny <Reuniao>()));
            _reuniaoRepositoryMockObject.Setup(p => p.Save(It.IsAny <Reuniao>())).Returns(_reuniaoDefaultWithId);

            //Action
            Reuniao retornoReuniao = _Reunioeservice.Alocacao(_reuniaoDefault);

            //Assert
            _reuniaoRepositoryMockObject.Verify(p => p.GetReuniaoBySalaId(It.IsAny <long>()), Times.Once());
            _reuniaoRepositoryMockObject.Verify(p => p.Save(It.IsAny <Reuniao>()), Times.Once());

            retornoReuniao.Id.Should().BeGreaterThan(0);
            retornoReuniao.Id.Should().Be(_reuniaoDefaultWithId.Id);
        }