public ApprenticeCommitmentsApiBuilder WithUsersFirstLogin()
        {
            var data = new VerifyRegistrationResponse {
                Email = "*****@*****.**", ApprenticeId = Guid.NewGuid()
            };
            var response = JsonConvert.SerializeObject(data, DefaultSerializerSettings);

            _server.Given(
                Request.Create()
                .WithPath("/registrations/*")
                .UsingGet()
                )
            .RespondWith(
                Response.Create()
                .WithStatusCode(HttpStatusCode.OK)
                .WithHeader("Content-Type", "application/json")
                .WithBody(response)
                );

            _server.Given(
                Request.Create()
                .WithPath("/registrations")
                .UsingPost()
                .WithBody(new JmesPathMatcher("contains(FirstName, 'Error')")))
            .RespondWith(
                Response.Create()
                .WithStatusCode(HttpStatusCode.BadRequest)
                .WithHeader("Content-Type", "application/json")
                .WithBodyAsJson(new[]
            {
                new { PropertyName = "FirstName", ErrorMessage = "Invalid FirstName" },
                new { PropertyName = "LastName", ErrorMessage = "Invalid LastName" },
                new { PropertyName = "DateOfBirth", ErrorMessage = "Invalid DateOfBirth" },
                new { PropertyName = "NationalInsuranceNumber", ErrorMessage = "Invalid NationalInsuranceNumber" },
                new { PropertyName = "Email", ErrorMessage = "Invalid email" },
                new { PropertyName = (string)null, ErrorMessage = "Registration {Id} id already verified" },
            }));

            _server.Given(
                Request.Create()
                .WithPath("/registrations")
                .UsingPost())
            .RespondWith(
                Response.Create()
                .WithStatusCode(HttpStatusCode.OK));

            return(this);
        }
        public async Task The_page_shows_my_email_address(
            [Frozen] Mock <IOuterApiClient> api,
            ConfirmYourIdentityModel sut,
            ClaimsPrincipal user,
            VerifyRegistrationResponse registration)
        {
            user.AddIdentity(new ClaimsIdentity(new[]
            {
                new Claim("registration_id", registration.ApprenticeId.ToString())
            }));
            registration.HasCompletedVerification = false;
            api.Setup(x => x.GetRegistration(registration.ApprenticeId)).Returns(Task.FromResult(registration));

            await sut.OnGetAsync(new AuthenticatedUser(user));

            sut.EmailAddress.Should().Be(registration.Email);
        }