public void When_handle_then_should_call_Are_correct_methods() { //Given var handler = CreateTarget(); var message = new SendEmployeeDigestEmail() { RecipientEmail = "*****@*****.**", GeneralRiskAssessmentsOverdueTasks = CreateRiskAssessmentsOverdueTasks(2), FireRiskAssessmentsOverdueTasks = CreateRiskAssessmentsOverdueTasks(2), }; //When handler.Handle(message); //Then _emailSender.Verify(x => x.Send(It.IsAny<RazorEmailResult>()), Times.AtLeast(1)); }
public static SendEmployeeDigestEmail CreateSendEmployeeDigestEmailCommand(Employee employee, EmployeeTasks employeeTasks) { var employeeDigestEmail = new SendEmployeeDigestEmail() { RecipientEmail = employee.GetEmail() //overdue tasks ,GeneralRiskAssessmentsOverdueTasks = employeeTasks.GeneralRiskAssessmentTasksOverdue .Where(task => CanSendTaskOverdueNotification(task,employee)) .Select(MapToTaskDetails).ToList() ,PersonalRiskAssessmentTasksOverdue = employeeTasks.PersonalRiskAssessmentTasksOverdue .Where(task => CanSendTaskOverdueNotification(task, employee)) .Select(MapToTaskDetails).ToList() ,FireRiskAssessmentsOverdueTasks = employeeTasks.FireRiskAssessmentTasksOverdue .Where(task => CanSendTaskOverdueNotification(task, employee)) .Select(MapToTaskDetails).ToList() ,HazardousSubstanceRiskAssessmentTasksOverdue = employeeTasks.HazadousSubstanceRiskAssessmentTasksOverdue .Where(task => CanSendTaskOverdueNotification(task, employee)) .Select(MapToTaskDetails).ToList() ,RiskAssessmentReviewTasksOverdue = employeeTasks.RiskAssessmentReviewTasksOverdue .Where(task => CanSendReviewTaskOverdueNotification(task, employee)) .Select(MapToTaskDetails).ToList() , ResponsibilitiesTasksOverdue = employeeTasks.ResponsibilityTaskOverdue .Where(task => CanSendResponsibilityTaskOverdueNotification(task, employee)) .Select(MapToTaskDetails).ToList() ,ActionTasksOverdue = employeeTasks.ActionTasksOverdue .Where( task => CanSendTaskOverdueNotification(task, employee)) .Select(MapToTaskDetails) .ToList() //Completed tasks ,HazardousSubstanceTasksCompleted = employeeTasks.HazardousSubstanceTasksCompleted .Where(task => CanSendTaskCompletedNotification(task, employee)) .Select(MapToTaskDetails) .ToList() , FireRiskAssessmentTasksCompleted = employeeTasks.FireRiskAssessmentTasksCompleted .Where(task => CanSendTaskOverdueNotification(task, employee)) .Select(MapToTaskDetails).ToList() , GeneralRiskAssessmentTasksCompleted = employeeTasks.GeneralRiskAssessmentTasksCompleted .Where(task => CanSendTaskCompletedNotification(task, employee)) .Select(MapToTaskDetails) .ToList() ,PersonalRiskAssessmentTasksCompleted = employeeTasks.PersonalRiskAssessmentTasksCompleted .Where(task => CanSendTaskCompletedNotification(task, employee)) .Select(MapToTaskDetails) .ToList() ,RiskAssessmentReviewTasksCompleted = employeeTasks.RiskAssessmentReviewTasksCompleted .Where(task => CanSendTaskCompletedNotification(task, employee)) .Select(MapToTaskDetails) .ToList() //Due Tomorrow tasks ,GeneralRiskAssessmentsTasksDueTomorrow = employeeTasks.GeneralRiskAssessmentTasksDueTomorrow .Where(task => CanSendTaskDueTomorrowNotification(task, employee)) .Select(MapToTaskDetails).ToList() ,PersonalRiskAssessmentTasksDueTomorrow = employeeTasks.PersonalRiskAssessmentTasksDueTomorrow .Where(task => CanSendTaskDueTomorrowNotification(task, employee)) .Select(MapToTaskDetails).ToList() ,FireRiskAssessmentsTasksDueTomorrow = employeeTasks.FireRiskAssessmentTasksDueTomorrow .Where(task => CanSendTaskDueTomorrowNotification(task, employee)) .Select(MapToTaskDetails).ToList() ,HazardousSubstanceRiskAssessmentTasksDueTomorrow = employeeTasks.HazardousSubstanceTasksDueTomorrow .Where(task => CanSendTaskDueTomorrowNotification(task, employee)) .Select(MapToTaskDetails).ToList() ,RiskAssessmentReviewTasksDueTomorrow = employeeTasks.RiskAssessmentReviewTasksDueTomorrow .Where(task => CanSendReviewTaskDueTomorrowNotification(task, employee)) .Select(MapToTaskDetails).ToList() ,ResponsibilitiesTasksDueTomorrow = employeeTasks.ResponsibilityTasksDueTomorrow .Where(task => CanSendTaskDueTomorrowNotification(task, employee)) .Select(MapToTaskDetails).ToList() ,ActionTasksDueTomorrow = employeeTasks.ActionTasksDueTomorrow .Where(task => CanSendActionTaskDueTomorrowNotification(task, employee)) .Select(MapToTaskDetails).ToList() }; return employeeDigestEmail; }