public void GeneratesValidWorkPatterns() { // Arrange (huge area) var numberOfOptions = 2; var numberOfPositions = 5; var mockPatternGenerator = new Mock <IPatternGenerator>(); mockPatternGenerator.Setup(generator => generator.GenerateLazy(numberOfOptions, numberOfPositions)) .Returns(PatternsToBeGenerated); var mockWorkPatternValidator = new Mock <IWorkPatternValidator>(); mockWorkPatternValidator.Setup(validator => validator.Validate(It.IsAny <WorkPatternRepresentation>())) .Returns(NoConsecutiveWorkdaysPredicate); var workPatternGenerator = new WorkPatternGenerator( numberOfOptions, numberOfPositions, mockPatternGenerator.Object, mockWorkPatternValidator.Object); // Act var validWorkPatterns = workPatternGenerator.GenerateValidPatterns(); // Assert Assert.Equal(2, validWorkPatterns.Count()); Assert.Collection(validWorkPatterns, firstPattern => Assert.Equal(PatternsToBeGenerated.First(), firstPattern), secondPattern => Assert.Equal(PatternsToBeGenerated.Skip(2).First(), secondPattern)); mockPatternGenerator.VerifyAll(); mockWorkPatternValidator.VerifyAll(); }
public void GeneratesValidSchedulesToCoverAllWorkingDaysInMonth() { // Arrange var generatedWorkPatterns = WorkPatternGenerator .GenerateValidPatterns() .ToList(); var monthlyScheduleGenerator = new MonthlyScheduleGenerator( People, Shifts, generatedWorkPatterns); // Act var schedules = monthlyScheduleGenerator.Generate(); // Assert Assert.Equal(People.Count(), schedules.Count()); }