public void SchedulingRepository_Update_InvalidId_ShouldBeFail()
        {
            Scheduling scheduling = ObjectMotherScheduling.GetScheduling();
            Action     comparison = () => _repository.Update(scheduling);

            comparison.Should().Throw <IdentifierUndefinedException>();
        }
Example #2
0
        public void SchedulingService_Delete_ShouldBeOk()
        {
            Scheduling scheduling = ObjectMotherScheduling.GetScheduling();

            scheduling.Id = 1;
            _mockRepository
            .Setup(m => m.Delete(scheduling));
            _service.Delete(scheduling);
            _mockRepository.Verify(m => m.Delete(scheduling));
        }
        public void SchedulingRepository_Save_InvalidNullRoom_ShouldBeFail()
        {
            Scheduling scheduling = ObjectMotherScheduling.GetScheduling();

            scheduling.Employee     = _mockEmployee.Object;
            _mockEmployee.Object.Id = 1;
            Action comparison = () => _repository.Save(scheduling);

            comparison.Should().Throw <SchedulingNullRoomException>();
        }
Example #4
0
        public void Scheduling_InvalidNullEmployee_ShouldBeFail()
        {
            Scheduling scheduling = ObjectMotherScheduling.GetScheduling();

            scheduling.Id   = 0;
            scheduling.Room = _mockRoom.Object;
            _mockRoom.Object.Disponibility = true;
            Action comparison = scheduling.Validate;

            comparison.Should().Throw <SchedulingNullEmployeeException>();
        }
Example #5
0
        public void SchedulingService_Save_InvalidEmptyOrNullName_ShouldBeFail()
        {
            Scheduling scheduling = ObjectMotherScheduling.GetSchedulingInvalidStartTime();

            scheduling.Employee = _mockEmployee.Object;
            scheduling.Room     = _mockRoom.Object;
            Action executeAction = () => _service.Add(scheduling);

            executeAction.Should().Throw <SchedulingStartTimeOverFlowException>();
            _mockRepository.VerifyNoOtherCalls();
        }
Example #6
0
        public void SchedulingService_Delete_InvalidId_ShouldBeFail()
        {
            Scheduling scheduling = ObjectMotherScheduling.GetScheduling();

            _mockRepository
            .Setup(m => m.Delete(scheduling));
            Action executeAction = () => _service.Delete(scheduling);

            executeAction.Should().Throw <IdentifierUndefinedException>();
            _mockRepository.VerifyNoOtherCalls();
        }
Example #7
0
        public void SchedulingService_Update_InvalidId_ShouldBeFail()
        {
            Scheduling scheduling = ObjectMotherScheduling.GetScheduling();

            scheduling.Employee = _mockEmployee.Object;
            scheduling.Room     = _mockRoom.Object;
            Action executeAction = () => _service.Update(scheduling);

            executeAction.Should().Throw <IdentifierUndefinedException>();
            _mockRepository.VerifyNoOtherCalls();
        }
Example #8
0
        public void Scheduling_InvalidEndTimeLessThanStartTime_ShouldBeFail()
        {
            Scheduling scheduling = ObjectMotherScheduling.GetSchedulingInvalidEndTime();

            scheduling.Id                  = 0;
            scheduling.Employee            = _mockEmployee.Object;
            scheduling.Room                = _mockRoom.Object;
            _mockRoom.Object.Disponibility = true;
            Action comparison = scheduling.Validate;

            comparison.Should().Throw <SchedulingEndTimeLessThanStartTimeException>();
        }
Example #9
0
        public void Scheduling_UnavailableRoom_ShouldBeFail()
        {
            Scheduling scheduling = ObjectMotherScheduling.GetScheduling();

            scheduling.Id                  = 0;
            scheduling.Employee            = _mockEmployee.Object;
            scheduling.Room                = _mockRoom.Object;
            _mockRoom.Object.Disponibility = false;
            Action comparison = scheduling.Validate;

            comparison.Should().Throw <SchedulingUnavailableRoomException>();
        }
Example #10
0
        public void Scheduling_Valid_ShouldBeOk()
        {
            Scheduling scheduling = ObjectMotherScheduling.GetScheduling();

            scheduling.Id                  = 0;
            scheduling.Employee            = _mockEmployee.Object;
            scheduling.Room                = _mockRoom.Object;
            _mockRoom.Object.Disponibility = true;
            Action comparison = scheduling.Validate;

            comparison.Should().NotThrow <Exception>();
        }
Example #11
0
        public void SchedulingService_Update_InvalidEndTimeLessThanStartTime_ShouldBeFail()
        {
            Scheduling scheduling = ObjectMotherScheduling.GetSchedulingInvalidEndTime();

            scheduling.Id       = 1;
            scheduling.Employee = _mockEmployee.Object;
            scheduling.Room     = _mockRoom.Object;
            Action executeAction = () => _service.Update(scheduling);

            executeAction.Should().Throw <SchedulingEndTimeLessThanStartTimeException>();
            _mockRepository.VerifyNoOtherCalls();
        }
Example #12
0
        public void SchedulingService_Get_ShouldBeOk()
        {
            int id = 1;

            _mockRepository
            .Setup(m => m.Get(id))
            .Returns(ObjectMotherScheduling.GetScheduling());
            Scheduling result = _service.Get(id);

            result.Should().NotBeNull();
            _mockRepository.Verify(m => m.Get(id));
        }
        public void SchedulingRepository_Save_ShouldBeOk()
        {
            Scheduling scheduling = ObjectMotherScheduling.GetScheduling();

            scheduling.Employee            = _mockEmployee.Object;
            _mockEmployee.Object.Id        = 1;
            scheduling.Room                = _mockRoom.Object;
            _mockRoom.Object.Id            = 1;
            _mockRoom.Object.Disponibility = true;
            Scheduling result = _repository.Save(scheduling);

            result.Should().NotBeNull();
            result.Id.Should().BeGreaterThan(0);
        }
Example #14
0
        public void SchedulingService_Add_ShouldBeOk()
        {
            Scheduling scheduling = ObjectMotherScheduling.GetScheduling();

            scheduling.Employee            = _mockEmployee.Object;
            scheduling.Room                = _mockRoom.Object;
            _mockRoom.Object.Disponibility = true;
            _mockRepository
            .Setup(m => m.Save(scheduling))
            .Returns(new Scheduling {
                Id = 1
            });
            Scheduling result = _service.Add(scheduling);

            result.Should().NotBeNull();
            result.Id.Should().BeGreaterThan(0);
            _mockRepository.Verify(m => m.Save(scheduling));
        }