public void Validate_WhenValid_HasNoErrors()
        {
            var mockPickListItem = new PickListItem {
                Id = 123
            };
            var mockLookupItem = new LookupItem {
                Id = Guid.NewGuid()
            };

            _mockStore
            .Setup(mock => mock.GetLookupItems("dfe_teachingsubjectlist"))
            .Returns(new[] { mockLookupItem }.AsQueryable());
            _mockStore
            .Setup(mock => mock.GetPickListItems("dfe_candidatepastteachingposition", "dfe_educationphase"))
            .Returns(new[] { mockPickListItem }.AsQueryable());

            var position = new CandidatePastTeachingPosition
            {
                SubjectTaughtId  = mockLookupItem.Id,
                EducationPhaseId = mockPickListItem.Id,
            };

            var result = _validator.TestValidate(position);

            result.IsValid.Should().BeTrue();
        }
        public void Constructor_WithCandidate_MapsCorrectly()
        {
            var latestQualification = new CandidateQualification()
            {
                Id              = Guid.NewGuid(),
                CreatedAt       = DateTime.UtcNow.AddDays(10),
                DegreeStatusId  = 1,
                UkDegreeGradeId = 2,
                TypeId          = 3,
                DegreeSubject   = "English"
            };

            var qualifications = new List <CandidateQualification>()
            {
                new CandidateQualification()
                {
                    Id = Guid.NewGuid(), CreatedAt = DateTime.UtcNow.AddDays(3)
                },
                latestQualification,
                new CandidateQualification()
                {
                    Id = Guid.NewGuid(), CreatedAt = DateTime.UtcNow.AddDays(5)
                },
            };

            var latestPastTeachingPosition = new CandidatePastTeachingPosition()
            {
                Id              = Guid.NewGuid(),
                CreatedAt       = DateTime.UtcNow.AddDays(10),
                SubjectTaughtId = Guid.NewGuid(),
            };

            var pastTeachingPositions = new List <CandidatePastTeachingPosition>()
            {
                new CandidatePastTeachingPosition()
                {
                    Id = Guid.NewGuid(), CreatedAt = DateTime.UtcNow.AddDays(3)
                },
                latestPastTeachingPosition,
                new CandidatePastTeachingPosition()
                {
                    Id = Guid.NewGuid(), CreatedAt = DateTime.UtcNow.AddDays(5)
                },
            };

            var candidate = new Candidate()
            {
                Id = Guid.NewGuid(),
                PreferredTeachingSubjectId = Guid.NewGuid(),
                CountryId = Guid.NewGuid(),
                InitialTeacherTrainingYearId = 1,
                PreferredEducationPhaseId    = 2,
                TypeId           = (int)Candidate.Type.ReturningToTeacherTraining,
                HasGcseEnglishId = (int)Candidate.GcseStatus.HasOrIsPlanningOnRetaking,
                HasGcseMathsId   = (int)Candidate.GcseStatus.HasOrIsPlanningOnRetaking,
                HasGcseScienceId = (int)Candidate.GcseStatus.HasOrIsPlanningOnRetaking,
                PlanningToRetakeGcseEnglishId = (int)Candidate.GcseStatus.HasOrIsPlanningOnRetaking,
                PlanningToRetakeGcseMathsId   = (int)Candidate.GcseStatus.HasOrIsPlanningOnRetaking,
                PlanningToRetakeGcseScienceId = (int)Candidate.GcseStatus.HasOrIsPlanningOnRetaking,
                Email                 = "*****@*****.**",
                FirstName             = "John",
                LastName              = "Doe",
                DateOfBirth           = DateTime.UtcNow,
                Telephone             = "1234567",
                TeacherId             = "abc123",
                AddressLine1          = "Address 1",
                AddressLine2          = "Address 2",
                AddressCity           = "City",
                AddressPostcode       = "KY11 9YU",
                Qualifications        = qualifications,
                PastTeachingPositions = pastTeachingPositions,
                HasTeacherTrainingAdviserSubscription = true,
            };

            var response = new TeacherTrainingAdviserSignUp(candidate);

            response.CandidateId.Should().Be(candidate.Id);
            response.PreferredTeachingSubjectId.Should().Be(candidate.PreferredTeachingSubjectId);
            response.CountryId.Should().Be(candidate.CountryId);
            response.InitialTeacherTrainingYearId.Should().Be(candidate.InitialTeacherTrainingYearId);
            response.PreferredEducationPhaseId.Should().Be(candidate.PreferredEducationPhaseId);
            response.HasGcseMathsAndEnglishId.Should().Be((int)Candidate.GcseStatus.HasOrIsPlanningOnRetaking);
            response.HasGcseScienceId.Should().Be(candidate.HasGcseScienceId);
            response.PlanningToRetakeGcseScienceId.Should().Be(candidate.PlanningToRetakeGcseScienceId);
            response.PlanningToRetakeGcseMathsAndEnglishId.Should().Be((int)Candidate.GcseStatus.HasOrIsPlanningOnRetaking);
            response.TypeId.Should().Be((int)Candidate.Type.ReturningToTeacherTraining);
            response.Email.Should().Be(candidate.Email);
            response.FirstName.Should().Be(candidate.FirstName);
            response.LastName.Should().Be(candidate.LastName);
            response.TeacherId.Should().Be(candidate.TeacherId);
            response.Telephone.Should().Be(candidate.Telephone);
            response.AddressLine1.Should().Be(candidate.AddressLine1);
            response.AddressLine2.Should().Be(candidate.AddressLine2);
            response.AddressCity.Should().Be(candidate.AddressCity);
            response.AddressPostcode.Should().Be(candidate.AddressPostcode);

            response.QualificationId.Should().Be(latestQualification.Id);
            response.DegreeStatusId.Should().Be(latestQualification.DegreeStatusId);
            response.UkDegreeGradeId.Should().Be(latestQualification.UkDegreeGradeId);
            response.DegreeSubject.Should().Be(latestQualification.DegreeSubject);
            response.DegreeTypeId.Should().Be(latestQualification.TypeId);

            response.PastTeachingPositionId.Should().Be(latestPastTeachingPosition.Id);
            response.SubjectTaughtId.Should().Be(latestPastTeachingPosition.SubjectTaughtId);

            response.AlreadySubscribedToTeacherTrainingAdviser.Should().BeTrue();
        }