public void ShouldBeAbleToReserveForQAIfQAUserNameIsFilledButStatusIsSubmitted()
        {
            var vacancySummary = new VacancySummary {
                QAUserName = AnotherUserName, Status = VacancyStatus.Submitted
            };

            var canBeReserved = new VacancyLockingServiceBuilder().Build()
                                .IsVacancyAvailableToQABy(UserName, vacancySummary);

            canBeReserved.Should().BeTrue();
        }
        public void ShouldBeAbleToReserveForQAIfTheVacancyIsReservedByMe(VacancyStatus currentVacancyStatus, bool expectedCanBeReserved)
        {
            var vacancySummary = new VacancySummary {
                Status = currentVacancyStatus, QAUserName = UserName
            };

            var canBeReserved = new VacancyLockingServiceBuilder().Build()
                                .IsVacancyAvailableToQABy(UserName, vacancySummary);

            canBeReserved.Should().Be(expectedCanBeReserved);
        }
        public void ShouldNotBeAbleToReserveForQAIfTheIfTheStatusIsNotReservedForQAOrSubmitted(VacancyStatus vacancyStatus)
        {
            var vacancySummary = new VacancySummary {
                Status = vacancyStatus
            };

            var canBeReserved = new VacancyLockingServiceBuilder().Build()
                                .IsVacancyAvailableToQABy(UserName, vacancySummary);

            canBeReserved.Should().BeFalse();
        }
        public void ShouldBeAbleToReserveForQAIfNobodyHasLockedTheVacancy()
        {
            var vacancySummary = new VacancySummary {
                Status = VacancyStatus.Submitted
            };

            var canBeReserved = new VacancyLockingServiceBuilder().Build()
                                .IsVacancyAvailableToQABy(UserName, vacancySummary);

            canBeReserved.Should().BeTrue();
        }
        public void ShouldntBeAbleToReserveForQAIfNobodyHasLockedTheVacancyButTheStateIsReserveForQA()
        {
            // TODO: this is a situation that should be impossible to reach (an invalid status of the vacancy summary)
            // but we test it because is not controlled by the entity itself
            var vacancySummary = new VacancySummary {
                Status = VacancyStatus.ReservedForQA
            };

            var canBeReserved = new VacancyLockingServiceBuilder().Build()
                                .IsVacancyAvailableToQABy(UserName, vacancySummary);

            canBeReserved.Should().BeFalse();
        }
        public void ShouldNotBeAbleToReserveForQAIfAnotherUserHasLockedTheVacancy(VacancyStatus currentVacancyStatus)
        {
            // Arrange
            var vacancySummary = new VacancySummary
            {
                QAUserName      = AnotherUserName,
                Status          = currentVacancyStatus,
                DateStartedToQA = _utcNow.AddMinutes(-SmallerTimeout)
            };

            var canBeReserved = new VacancyLockingServiceBuilder().Build()
                                .IsVacancyAvailableToQABy(UserName, vacancySummary);

            canBeReserved.Should().BeFalse();
        }