public void When_new_checklist_generation_Then_display_employees_without_email_first_and_order_by_surname()
        {
            _employeeService.Setup(x => x.GetAll(_companyId)).
              Returns(_employees);

            // Given
            _target = GetTarget();

            // When
            var viewModel = _target
                .WithRiskAssessorEmail(_riskAssessorEmail)
                .WithCompanyId(_companyId)
                .WithCurrentUserId(_currentUserId)
                .GetViewModel();

            var employees = viewModel.MultiSelectedEmployees.Select(x => x.Name).ToList();

            // Then
            Assert.That(employees.ElementAt(0), Is.EqualTo("Barry Brown")); // NO EMAIL ADDRESS
            Assert.That(employees.ElementAt(1), Is.EqualTo("cyril cyan")); // EMPTY EMAIL ADDRESS
            Assert.That(employees.ElementAt(2), Is.EqualTo("rachel red"));  // NO EMAIL ADDRESS
            Assert.That(employees.ElementAt(3), Is.EqualTo("Xavi Xander")); // NO EMAIL ADDRESS
            Assert.That(employees.ElementAt(4), Is.EqualTo("Armstrong Armstrong")); // EMAIL ADDRESS
            Assert.That(employees.ElementAt(5), Is.EqualTo("percy purple")); // EMAIL ADDRESS
        }
        public void When_new_checklist_generation_Then_display_employees_without_email_first()
        {
            _employeeService.Setup(x => x.GetAll(_companyId)).
              Returns(_employees);
            
            // Given
            _target = GetTarget();

            // When
            var viewModel = _target
                .WithRiskAssessorEmail(_riskAssessorEmail)
                .WithCompanyId(_companyId)
                .WithCurrentUserId(_currentUserId)
                .GetViewModel();

            var emails = viewModel.MultiSelectedEmployees.Select(x => x.Email).ToList();
            
            // Then
            Assert.That(emails.ElementAt(0), Is.Null);
            Assert.That(string.IsNullOrEmpty(emails.ElementAt(1)), Is.True);
            Assert.That(emails.ElementAt(2), Is.Null);
            Assert.That(emails.ElementAt(3), Is.Null);
            Assert.That(string.IsNullOrEmpty(emails.ElementAt(4)), Is.False);
            Assert.That(string.IsNullOrEmpty(emails.ElementAt(5)), Is.False);
        }
        public void When_new_checklist_generation_Then_accept_risk_assessor_email()
        {
            // Given
            _target = GetTarget();

            // When
            var viewModel = _target
                .WithRiskAssessorEmail(_riskAssessorEmail)
                .WithCompanyId(_companyId)
                .WithCurrentUserId(_currentUserId)
                .GetViewModel();

            // Then
            Assert.That(viewModel.CompletionNotificationEmailAddress, Is.EqualTo(_riskAssessorEmail));
        }
        public void ReturnedViewModelHasAvailableChecklists()
        {
            // Given
            _target = GetTarget();

            // When
            var viewModel = _target
                .WithCompanyId(_companyId)
                .WithCurrentUserId(_currentUserId)
                .GetViewModel();

            // Then
            Assert.That(viewModel.Checklists.Count(), Is.EqualTo(_checklists.Count()));
            for (var i = 0; i < _checklists.Count(); i++)
            {
                Assert.That(viewModel.Checklists.ElementAt(i).Id, Is.EqualTo(_checklists.ElementAt(i).Id));
                Assert.That(viewModel.Checklists.ElementAt(i).Title, Is.EqualTo(_checklists.ElementAt(i).Title));
            }
        }
        public void ReturnedViewModelHasCorrectEmployees()
        {
            _target = GetTarget();

            var viewModel = _target
                .WithCompanyId(_companyId)
                .WithCurrentUserId(_currentUserId)
                .GetViewModel();

            var employees = viewModel.Employees.ToList();
            Assert.That(employees.Count(), Is.EqualTo(_employees.Count + 1));
            Assert.That(employees[1].label,
                        Is.EqualTo(string.Format("{0} ({1})", _employees[0].FullName, _employees[0].MainContactDetails.Email)));
            Assert.That(employees[1].value, Is.EqualTo(_employees[0].Id.ToString()));
            Assert.That(employees[2].label, Is.EqualTo(string.Format("{0}", _employees[1].FullName)));
            Assert.That(employees[2].value, Is.EqualTo(_employees[1].Id.ToString()));
        }
        public void RetrievesEmployeesForRequestedCompany()
        {
            // Given
            _target = GetTarget();

            // When
            _target
                .WithCompanyId(_companyId)
                .WithCurrentUserId(_currentUserId)
                .GetViewModel();

            // Then
            _employeeService.Verify(x => x.GetAll(_companyId));
        }