public void DoNotBaseStrategyOnDateOfBirth(int day, bool shouldSendReminder) { var dateOfBirth = new DateTime(1985, 1, day); var dateCreated = DateTime.UtcNow.AddDays(-1); var user = new UserBuilder(_candidateId).WithDateCreated(dateCreated).Activated(false).Build(); var candidate = new CandidateBuilder(_candidateId).WithDateOfBirth(dateOfBirth).Build(); var communicationService = new Mock <ICommunicationService>(); var successor = new Mock <IHousekeepingStrategy>(); var strategy = new SendAccountRemindersStrategyBuilder().With(successor.Object).With(communicationService).Build(); Assert(shouldSendReminder, strategy, successor, communicationService, user, candidate); }
public void DoNotSendReminderBeforeOneDay() { var dateOfBirth = new DateTime(1985, 1, 2); var dateCreated = DateTime.UtcNow; var user = new UserBuilder(_candidateId).WithDateCreated(dateCreated).Activated(false).Build(); var candidate = new CandidateBuilder(_candidateId).WithDateOfBirth(dateOfBirth).Build(); var communicationService = new Mock <ICommunicationService>(); var successor = new Mock <IHousekeepingStrategy>(); var strategy = new SendAccountRemindersStrategyBuilder().With(successor.Object).With(communicationService).Build(); Assert(false, strategy, successor, communicationService, user, candidate); }
public void CompleteStrategyTestHours(int hours, bool shouldSendReminder) { var dateOfBirth = new DateTime(1985, 1, 2); var dateCreated = DateTime.UtcNow.AddHours(-hours).AddMinutes(-30); var user = new UserBuilder(_candidateId).WithDateCreated(dateCreated).Activated(false).Build(); var candidate = new CandidateBuilder(_candidateId).WithDateOfBirth(dateOfBirth).Build(); var configurationService = new Mock <IConfigurationService>(); configurationService.Setup(s => s.Get <HousekeepingConfiguration>()).Returns(new HousekeepingConfigurationBuilder().WithStrategy(1, 1, 1, 6).Build()); var communicationService = new Mock <ICommunicationService>(); var successor = new Mock <IHousekeepingStrategy>(); var strategy = new SendAccountRemindersStrategyBuilder().With(configurationService).With(successor.Object).With(communicationService).Build(); Assert(shouldSendReminder, strategy, successor, communicationService, user, candidate); }