private static string GetPotentiallyNullCompletedOnEmployeesBehalfName(EmployeeChecklistDto employeeChecklist) { return employeeChecklist.CompletedOnEmployeesBehalfBy != null && employeeChecklist.CompletedOnEmployeesBehalfBy.Employee != null ? employeeChecklist.CompletedOnEmployeesBehalfBy.Employee.FullName : null; }
public void Setup() { _employeeChecklistDto = new EmployeeChecklistDto {Answers = new List<PersonalAnswerDto>(), Employee = new EmployeeDto(), Id = Guid.NewGuid()}; _employeeChecklistDto.Checklist = new ChecklistDto { Sections = new List<SectionDto>() { new SectionDto { Id = 1, Title = "3rd Section", ListOrder = 3 , Questions = new List<QuestionDto>() { new QuestionDto() {Id = 5, ListOrder = 3, Text = "question 3"} , new QuestionDto() {Id = 3, ListOrder = 1, Text = "question 1"} , new QuestionDto() {Id = 7, ListOrder = 2, Text = "question 2"} } } , new SectionDto {Id = 2, Title = "1st Section", ListOrder = 1, Questions = new List<QuestionDto>()} , new SectionDto {Id = 3, Title = "2nd Section", ListOrder = 2, Questions = new List<QuestionDto>()} } }; _employeeChecklistService = new Mock<IEmployeeChecklistService>(); _target = new EmployeeChecklistViewModelFactory(_employeeChecklistService.Object); _employeeChecklistService.Setup(x => x.GetById(It.IsAny<Guid>())).Returns(() => _employeeChecklistDto); }
public void Setup() { _baseEmployeeChecklistDto = new EmployeeChecklistDto() { Checklist = new ChecklistDto { Title = "checklist 1" }, CompletionNotificationEmailAddress = "riskassessor email", DueDateForCompletion = DateTime.Now.AddDays(10), FriendlyReference = "chk_ref_1", EmployeeChecklistEmails = new List<EmployeeChecklistEmailDto> { new EmployeeChecklistEmailDto { Message = "message body", RecipientEmail = "recipient email", } }, Employee = new EmployeeDto{ FullName = "recipient" }, IsFurtherActionRequired = true, AssessedByEmployee = new EmployeeForAuditingDto() { Id = Guid.NewGuid(), FullName = "assessor" }, AssessmentDate = DateTime.Now }; _employeeChecklistService = new Mock<IEmployeeChecklistService>(); _employeeChecklistService .Setup(x => x.GetById(It.IsAny<Guid>())) .Returns(_baseEmployeeChecklistDto); }
public void Setup() { _currentUserId = Guid.NewGuid(); _employee1 = new EmployeeDto() { FullName = "Barry Griffthes", MainContactDetails = new EmployeeContactDetailDto { Email = "*****@*****.**" } }; _checklist1 = new ChecklistDto() { Title = "Title 1" }; var employeeChecklist1 = new EmployeeChecklistDto { Employee = _employee1, Checklist = _checklist1, CompletedDate = DateTime.Now, Id = Guid.NewGuid(), IsFurtherActionRequired = true }; _employee2 = new EmployeeDto() { FullName = "Dave Smith", MainContactDetails = new EmployeeContactDetailDto { Email = "*****@*****.**" } }; _checklist2 = new ChecklistDto() { Title = "Title 2" }; var employeeChecklist2 = new EmployeeChecklistDto { Employee = _employee2, Checklist = _checklist2, Id = Guid.NewGuid(), }; _employeeChecklists = new List<EmployeeChecklistDto> { employeeChecklist1, employeeChecklist2 }; _personalRiskAssessmentDto = new PersonalRiskAssessmentDto {EmployeeChecklists = _employeeChecklists, PersonalRiskAssessementEmployeeChecklistStatus = PersonalRiskAssessementEmployeeChecklistStatusEnum.Generated}; _personalRiskAssessmentService = new Mock<IPersonalRiskAssessmentService>(); }
public EmployeeChecklistDto Map(EmployeeChecklist entity) { var dto = new EmployeeChecklistDto { Id = entity.Id, Employee = new EmployeeDtoMapper().MapWithNationalityAndContactDetailsAndEmergencyContactDetails(entity.Employee), Checklist = new ChecklistDtoMapper().MapWithSections(entity.Checklist), Answers = new PersonalAnswerDtoMapper().Map(entity.Answers), StartDate = entity.StartDate, CompletedDate = entity.CompletedDate, Password = entity.Password, FriendlyReference = entity.FriendlyReference, CompletionNotificationEmailAddress = entity.CompletionNotificationEmailAddress, DueDateForCompletion = entity.DueDateForCompletion, SendCompletedChecklistNotificationEmail = entity.SendCompletedChecklistNotificationEmail ?? false, LastRecipientEmail = entity.LastRecipientEmail, LastMessage = entity.LastMessage, IsFurtherActionRequired = entity.IsFurtherActionRequired, AssessedByEmployee = new EmployeeForAuditingDtoMapper().Map(entity.AssessedByEmployee), AssessmentDate = entity.AssessmentDate }; return dto; }
private static string GetPotentiallyNullRecipientEmail(EmployeeChecklistDto employeeChecklist) { return employeeChecklist.Employee.MainContactDetails != null ? employeeChecklist.Employee.MainContactDetails.Email : null; }
private static string GetPotentiallyNullDueDateForCompletion(EmployeeChecklistDto employeeChecklist) { return employeeChecklist.DueDateForCompletion.HasValue ? employeeChecklist.DueDateForCompletion.Value.ToShortDateString() : string.Empty; }
private static string GetPotentiallyNullCompleteDate(EmployeeChecklistDto employeeChecklist) { return employeeChecklist.CompletedDate.HasValue ? employeeChecklist.CompletedDate.Value.ToShortDateString() : string.Empty; }
private static bool GetNotificationRequired(EmployeeChecklistDto employeeChecklist) { return employeeChecklist.SendCompletedChecklistNotificationEmail.HasValue && employeeChecklist.SendCompletedChecklistNotificationEmail.Value; }
private static string GetPotentiallyNullAssessedBy(EmployeeChecklistDto employeeChecklist) { return employeeChecklist.AssessedByEmployee != null ? employeeChecklist.AssessedByEmployee.FullName : string.Empty; }
private static bool? GetPotentiallyNullIsFurtherActionRequired(EmployeeChecklistDto employeeChecklist) { return employeeChecklist.IsFurtherActionRequired.HasValue ? (bool?)employeeChecklist.IsFurtherActionRequired.Value : null; }
private string GetIsFurtherActionRequiredDisplayText(EmployeeChecklistDto employeeChecklist) { if (!employeeChecklist.CompletedDate.HasValue) return string.Empty; if (!employeeChecklist.IsFurtherActionRequired.HasValue) return string.Empty; return employeeChecklist.IsFurtherActionRequired.Value ? "Yes" : "No"; }