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); }
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); }
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); }
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); }