public async Task GetProfileDataAsync_GivenApplicationUserWithOrganisationFunction_ReturnExpectedClaimList(
            string organisationFunctionDisplayName,
            params string[] expectedClaimTypes)
        {
            var expectedApplicationUser = ApplicationUserBuilder
                                          .Create()
                                          .WithUsername(string.Empty)
                                          .WithFirstName(string.Empty)
                                          .WithLastName(string.Empty)
                                          .WithEmailAddress(string.Empty)
                                          .WithOrganisationFunction(OrganisationFunction.FromDisplayName(organisationFunctionDisplayName))
                                          .Build();

            Mock <IUsersRepository> applicationUserRepositoryMock = new Mock <IUsersRepository>();

            applicationUserRepositoryMock.Setup(x => x.GetByIdAsync(It.IsAny <string>()))
            .ReturnsAsync(expectedApplicationUser);

            var expectedOrganisation = OrganisationBuilder
                                       .Create()
                                       .Build();

            Mock <IOrganisationRepository> organisationRespositoryMock = new Mock <IOrganisationRepository>();

            organisationRespositoryMock.Setup(r => r.GetByIdAsync(It.IsAny <Guid>()))
            .ReturnsAsync(expectedOrganisation);

            var sut = ProfileServiceBuilder
                      .Create()
                      .WithUserRepository(applicationUserRepositoryMock.Object)
                      .WithOrganisationRepository(organisationRespositoryMock.Object)
                      .Build();

            var profileDataRequestContext = ProfileDataRequestContextBuilder
                                            .Create()
                                            .WithSubjectId(expectedApplicationUser.Id)
                                            .Build();

            await sut.GetProfileDataAsync(profileDataRequestContext);

            var actual = profileDataRequestContext.IssuedClaims.Select(item => item.Type);

            actual.Should().BeEquivalentTo(expectedClaimTypes);
        }
        private ApplicationUser(
            string userName,
            string firstName,
            string lastName,
            string phoneNumber,
            string email,
            OrganisationFunction organisationFunction,
            Guid primaryOrganisationId)
        {
            if (userName is null)
            {
                throw new ArgumentNullException(nameof(userName));
            }

            if (firstName is null)
            {
                throw new ArgumentNullException(nameof(firstName));
            }

            if (lastName is null)
            {
                throw new ArgumentNullException(nameof(lastName));
            }

            if (email is null)
            {
                throw new ArgumentNullException(nameof(email));
            }

            UserName           = userName.Trim();
            NormalizedUserName = UserName.ToUpperInvariant();
            FirstName          = firstName.Trim();
            LastName           = lastName.Trim();
            PhoneNumber        = phoneNumber?.Trim() ?? throw new ArgumentNullException(nameof(phoneNumber));
            Email                    = email.Trim();
            NormalizedEmail          = Email.ToUpperInvariant();
            OrganisationFunction     = organisationFunction ?? throw new ArgumentNullException(nameof(organisationFunction));
            PrimaryOrganisationId    = primaryOrganisationId;
            Disabled                 = false;
            CatalogueAgreementSigned = false;
        }