public void Validate_ShouldThrowException_WhenTimesheetContainsInvalid(TestTimesheet timesheet, [Frozen] Mock <IWorkedHoursCalculator> workedHoursCalculatorMock, TimesheetValidator sut) { // act.. sut.AdjustTimesheet(timesheet); // assert.. timesheet.Weeks.ShouldNotBeEmpty(); timesheet.Weeks.SelectMany(tw => tw.WorkDays).ShouldNotBeEmpty(); var days = timesheet.Weeks.SelectMany(tw => tw.WorkDays); workedHoursCalculatorMock.Verify(m => m.VerifyTimes(It.IsAny <IWorkDay>()), Times.Exactly(days.Count())); }
public void Validate_ShouldCall_VerifyTimes_On_IWorkedHoursCalculator_ForEveryWorkDay(TestTimesheet timesheet, [Frozen] Mock <IWorkedHoursCalculator> workedHoursCalculatorMock, TimesheetValidator sut) { // act.. sut.AdjustTimesheet(timesheet); // assert.. timesheet.Weeks.ShouldNotBeEmpty(); timesheet.Weeks.SelectMany(tw => tw.WorkDays).ShouldNotBeEmpty(); var days = timesheet.Weeks.SelectMany(tw => tw.WorkDays); workedHoursCalculatorMock.Verify(m => m.VerifyTimes(It.IsAny <IWorkDay>()), Times.Exactly(days.Count())); }