コード例 #1
0
        public void GetFlagsDoesNotAddUrgentCoverFlagToCoveredEvent()
        {
            var testEvent = GetTestEvent();

            var urgentThreshold = 15;

            var options = new FlagServiceOptions
            {
                UrgentCoverThreshold = urgentThreshold
            };

            testEvent.Date = DateTime.Today.AddDays(urgentThreshold - 1);
            testEvent.Deployments.Clear();
            testEvent.Deployments.Add(_fixture.Create <Deployment>());
            testEvent.Deployments.Add(_fixture.Create <Deployment>());
            testEvent.Deployments.Add(_fixture.Create <Deployment>());
            testEvent.CyclistsRequested = 3;
            testEvent.DateConfirmed     = true;

            var expectedFlag = Flags.UrgentCoverNeeded;

            var flagService = new FlagService(Options.Create(options));

            var actualFlag = flagService.GetFlags(testEvent, expectedFlag);

            actualFlag.Should().NotContain(expectedFlag);
        }
コード例 #2
0
        public void GetFlagsDoesNotAddBriefingNotesReadyIfEventIsDistant()
        {
            var testEvent = GetTestEvent();

            var notesThreshold = 14;

            var options = new FlagServiceOptions
            {
                SendBriefingNotesThreshold = notesThreshold
            };

            testEvent.Date = DateTime.Today.AddDays(notesThreshold + 1);
            testEvent.Schedule.Add(_fixture.Create <ScheduleItem>());
            testEvent.Deployments.Add(_fixture.Create <Deployment>());
            testEvent.ExpectedIncidents.Add(_fixture.Create <ExpectedIncident>());
            testEvent.BriefingNotesSent = false;

            var expectedFlag = Flags.BriefingNotesReady;

            var flagService = new FlagService(Options.Create(options));

            var actualFlag = flagService.GetFlags(testEvent, expectedFlag);

            actualFlag.Should().NotContain(expectedFlag);
        }
コード例 #3
0
        public void GetFlagsAddsBriefingNotesSentIfBriefingHasBeenSent()
        {
            var testEvent = GetTestEvent();

            var options = new FlagServiceOptions();

            testEvent.BriefingNotesSent = true;

            var expectedFlag = Flags.BriefingNotesSent;

            var flagService = new FlagService(Options.Create(options));

            var actualFlag = flagService.GetFlags(testEvent, expectedFlag);

            actualFlag.Should().Contain(expectedFlag);
        }
コード例 #4
0
        public void GetFlagsAddsNeedsEmailingToSoonEventNotRecentlyEmailed()
        {
            var testEvent = GetTestEvent();

            var sendEmailThreshold    = 90;
            var emailCautionThreshold = 45;

            var options = new FlagServiceOptions
            {
                SendEmailThreshold    = sendEmailThreshold,
                EmailCautionThreshold = emailCautionThreshold
            };

            testEvent.Date           = DateTime.Today.AddDays(sendEmailThreshold - 1);
            testEvent.LastEmailedOut = DateTime.Today.AddDays(-(emailCautionThreshold + 1));

            var expectedFlag = Flags.NeedsEmailing;

            var flagService = new FlagService(Options.Create(options));

            var actualFlag = flagService.GetFlags(testEvent, expectedFlag);

            actualFlag.Should().Contain(expectedFlag);
        }