public SampleProvider()
        {
            this.sampleElectronicMailAddressHome =
                new ElectronicMailAddress
            {
                ItemType = ElectronicMailAddress.Home,
                Value    = SampleProvider.ElectronicMailAddressHome
            };

            this.sampleElectronicMailAddressWork =
                new ElectronicMailAddress
            {
                ItemType = ElectronicMailAddressWork,
                Primary  = true,
                Value    = SampleProvider.ElectronicMailAddressWork
            };

            this.sampleElectronicMailAddresses =
                new ElectronicMailAddress[]
            {
                this.sampleElectronicMailAddressHome,
                this.sampleElectronicMailAddressWork
            };

            this.sampleManager =
                new Manager()
            {
                Value = SampleProvider.ManagerIdentifier,
            };

            this.sampleName =
                new Name()
            {
                FamilyName      = SampleProvider.NameFamily,
                Formatted       = SampleProvider.NameFormatted,
                GivenName       = SampleProvider.NameGiven,
                HonorificPrefix = SampleProvider.NameHonorificPrefix,
                HonorificSuffix = SampleProvider.NameHonorificSuffix
            };

            this.sampleOperationValue =
                new OperationValue()
            {
                Value = SampleProvider.IdentifierUser
            };

            this.sampleOperation = this.ConstructOperation();

            this.samplePatch = this.ConstructPatch();

            this.sampleUser =
                new Core2EnterpriseUser()
            {
                Active = true,
                ElectronicMailAddresses = this.sampleElectronicMailAddresses,
                ExternalIdentifier      = SampleProvider.IdentifierExternal,
                Identifier = SampleProvider.IdentifierUser,
                Name       = this.sampleName,
                UserName   = SampleProvider.NameUser
            };

            ExtensionAttributeEnterpriseUser2 enterpriseExtensionAttributeEnterpriseUser2 =
                new ExtensionAttributeEnterpriseUser2()
            {
                CostCenter     = SampleProvider.ExtensionAttributeEnterpriseUserCostCenter,
                Department     = SampleProvider.ExtensionAttributeEnterpriseUserDepartment,
                Division       = SampleProvider.ExtensionAttributeEnterpriseUserDivision,
                EmployeeNumber = SampleProvider.ExtensionAttributeEnterpriseUserEmployeeNumber,
                Manager        = this.sampleManager,
                Organization   = SampleProvider.ExtensionAttributeEnterpriseUserOrganization
            };

            this.SampleUser.EnterpriseExtension = enterpriseExtensionAttributeEnterpriseUser2;

            this.sampleGroup =
                new Core2Group()
            {
                DisplayName = SampleProvider.GroupName,
            };
        }
        private static Resource[] QueryMember(IQueryParameters parameters, IFilter filter)
        {
            if (null == parameters)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            if (null == filter)
            {
                throw new ArgumentNullException(nameof(filter));
            }

            if (null == filter.AdditionalFilter)
            {
                throw new ArgumentException(SystemForCrossDomainIdentityManagementServiceResources.ExceptionQueryNotSupported);
            }

            Resource[] results = null;

            if (parameters.ExcludedAttributePaths != null && parameters.ExcludedAttributePaths.Any())
            {
                throw new ArgumentException(SystemForCrossDomainIdentityManagementServiceResources.ExceptionQueryNotSupported);
            }

            if (!string.Equals(parameters.SchemaIdentifier, SchemaIdentifiers.Core2Group, StringComparison.Ordinal))
            {
                throw new NotSupportedException(SystemForCrossDomainIdentityManagementServiceResources.ExceptionQueryNotSupported);
            }

            if (null == parameters.RequestedAttributePaths || !parameters.RequestedAttributePaths.Any())
            {
                throw new NotSupportedException(SystemForCrossDomainIdentityManagementServiceResources.ExceptionQueryNotSupported);
            }

            if (filter.AdditionalFilter.AdditionalFilter != null)
            {
                throw new NotSupportedException(SystemForCrossDomainIdentityManagementServiceResources.ExceptionQueryNotSupported);
            }

            string selectedAttribute = parameters.RequestedAttributePaths.SingleOrDefault();

            if (string.IsNullOrWhiteSpace(selectedAttribute))
            {
                throw new NotSupportedException(SystemForCrossDomainIdentityManagementServiceResources.ExceptionQueryNotSupported);
            }

            if (!string.Equals(selectedAttribute, AttributeNames.Identifier, StringComparison.OrdinalIgnoreCase))
            {
                throw new NotSupportedException(SystemForCrossDomainIdentityManagementServiceResources.ExceptionQueryNotSupported);
            }

            IReadOnlyCollection <IFilter> filters =
                new IFilter[]
            {
                filter,
                filter.AdditionalFilter
            };

            IFilter filterIdentifier =
                filters
                .SingleOrDefault(
                    (IFilter item) =>
                    item.AttributePath.Equals(AttributeNames.Identifier, StringComparison.OrdinalIgnoreCase));

            if (null == filterIdentifier)
            {
                throw new NotSupportedException(SystemForCrossDomainIdentityManagementServiceResources.ExceptionQueryNotSupported);
            }

            IFilter filterMembers =
                filters
                .SingleOrDefault(
                    (IFilter item) =>
                    item.AttributePath.Equals(AttributeNames.Members, StringComparison.OrdinalIgnoreCase));

            if (null == filterMembers)
            {
                throw new NotSupportedException(SystemForCrossDomainIdentityManagementServiceResources.ExceptionQueryNotSupported);
            }

            IResourceIdentifier containerIdentifier =
                new ResourceIdentifier()
            {
                SchemaIdentifier = parameters.SchemaIdentifier,
                Identifier       = filterIdentifier.ComparisonValue
            };

            if (!SampleProvider.HasMember(containerIdentifier, filterMembers.AttributePath, filterMembers.ComparisonValue))
            {
                results = Array.Empty <Resource>();
            }
            else
            {
                Resource container =
                    new Core2Group()
                {
                    Identifier = containerIdentifier.Identifier
                };
                results = container.ToCollection().ToArray();
            }

            return(results);
        }