Inheritance: Microsoft.Protocols.TestTools.TestClassBase
        public void MSCPSWS_S01_TC09_EntityTypes_ValidProviderNames()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            bool isEntityTypesSuccess = false;

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                ArrayOfString providerNames = new ArrayOfString();
                providerNames.Add(provider.ProviderName);

                // Call EntityTypes method to get entity types with valid providerNames in the request.
                ArrayOfString responseOfEntityTypesResult = CPSWSAdapter.EntityTypes(providerNames);
                Site.Assert.IsNotNull(responseOfEntityTypesResult, "If the providerNames is a valid providerNames, the protocol server MUST use the current available claims providers.");

                // Call GetEntityTypesResultBySutAdapter method to get entity types with valid providerNames in the request.
                ArrayOfString getEntityTypesResultBySutAdapter = GetEntityTypesResultBySutAdapter(providerNames);
                Site.Assert.IsTrue(this.VerificationSutResultsAndProResults(responseOfEntityTypesResult, getEntityTypesResultBySutAdapter), "The entity types returned by the protocol and script should be equal.");
                isEntityTypesSuccess = true;
            }

            // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                isEntityTypesSuccess,
                178,
                @"[In EntityTypes] The protocol server MUST retrieve picker entity types from claims providers that meet both of the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.");
        }
        public void MSCPSWS_S04_TC08_Resolve_NullResolveInput()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.User;

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            bool caughtException = false;

            try
            {
                // Call Resolve multiple method with resolveInput parameter sets to null.
                CPSWSAdapter.Resolve(providerNames, principalType, null);
            }
            catch (FaultException faultException)
            {
                caughtException = true;

                // If the server returns an ArgumentNullException<""value""> message, then the following requirement can be captured.
                Site.CaptureRequirementIfIsTrue(
                    this.VerifyArgumentNullException(faultException, "value"),
                    616,
                    @"[In Resolve] If this [resolveInput] is NULL, the protocol server MUST return an ArgumentNullException<""value""> message.");
            }
            finally
            {
                this.Site.Assert.IsTrue(caughtException, "If resolveInput is NULL, the protocol server should return an ArgumentNullException<value> message.");
            }
        }
        public void MSCPSWS_S04_TC02_ResolveClaim_Valid()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames         = new ArrayOfString();
            SPPrincipalType principalType         = SPPrincipalType.SecurityGroup;
            SPClaim         resolveInput          = GenerateSPClaimResolveInput_Valid();
            bool            isResolveClaimSuccess = false;

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                if (provider.Children.Length != 0)
                {
                    providerNames.Add(provider.ProviderName);
                }

                // Call Resolve claim method to resolve an SPClaim to picker entities using a list of claims providers.
                PickerEntity[] responseOfResolveClaimResult = CPSWSAdapter.ResolveClaim(providerNames, principalType, resolveInput);
                Site.Assert.IsNotNull(responseOfResolveClaimResult, "The resolve claim result should not be null.");
                isResolveClaimSuccess = true;
            }

            // If the claims providers listed in the provider names in the input message is resolved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                isResolveClaimSuccess,
                303,
                @"[In ResolveClaim] The protocol server MUST resolve across all claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support resolve.");
        }
        public void MSCPSWS_S02_TC03_GetHierarchy_ValidNumberOfLevels()
        {
            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            SPPrincipalType principalType         = SPPrincipalType.SharePointGroup;
            string          providerName          = null;
            bool            isGetHierarchySuccess = false;

            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                // Filter the providers, hierarchy providers which name is started with "_HierarchyProvider_" are not supported by GetHierarchy method.
                if (provider.ProviderName != null && !provider.ProviderName.StartsWith(Common.GetConfigurationPropertyValue("HierarchyProviderPrefix", this.Site)))
                {
                    providerName = provider.ProviderName;

                    // Call GetHierarchy method to get a claims provider hierarchy tree with a valid numberOfLevels parameter in the request.
                    SPProviderHierarchyTree responseOfGetHierarchyResult = CPSWSAdapter.GetHierarchy(providerName, principalType, null, numberOfLevels);
                    Site.Assert.IsNotNull(responseOfGetHierarchyResult, "If the numberOfLevels is a valid value, the protocol server MUST use the current available claims providers.");
                    isGetHierarchySuccess = true;

                    // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
                    Site.CaptureRequirementIfIsTrue(
                        isGetHierarchySuccess,
                        194,
                        @"[In GetHierarchy] The protocol server MUST retrieve a claims provider hierarchy tree from the claims provider that meets all the following criteria:
The claims provider name is specified in the input message.
The claims provider is associated with the Web application (1) specified in the input message.
The claims provider supports hierarchy.");
                }
            }
        }
        /// <summary>
        /// A method used to generate a valid SPProviderSearchArguments of IClaimProviderWebService_Search_InputMessage.
        /// </summary>
        /// <returns>A return value represents the valid SPProviderSearchArguments. Return "null" if there is no valid search argument.</returns>
        public SPProviderSearchArguments GenerateProviderSearchArgumentsInput_Valid()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            SPProviderSearchArguments providerSearchArgumentsInput = null;

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                // Find the first provider tree with at least a child.
                if (provider.Children.Length != 0)
                {
                    providerSearchArgumentsInput = new SPProviderSearchArguments();

                    // Set the search condition by the first child of this tree.
                    providerSearchArgumentsInput.HierarchyNodeID = provider.Children[0].HierarchyNodeID;
                    providerSearchArgumentsInput.ProviderName    = provider.Children[0].ProviderName;
                    providerSearchArgumentsInput.MaxCount        = Convert.ToInt32(Common.GetConfigurationPropertyValue("MaxCount", this.Site));
                    TestSuiteBase.SearchPattern = provider.Children[0].Nm;

                    break;
                }
            }

            return(providerSearchArgumentsInput);
        }
        public void MSCPSWS_S02_TC06_GetHierarchyAll_AllOfProviderNames()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] getAllProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.User;

            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            foreach (SPProviderHierarchyTree provider in getAllProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            // Call GetHierarchyAll method to get a list of claims provider hierarchy trees with all of valid providerNames in the request.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = CPSWSAdapter.GetHierarchyAll(providerNames, principalType, numberOfLevels);
            Site.Assert.IsNotNull(responseOfGetHierarchyAllResult, "If the providerNames is all of valid providerNames, the protocol server MUST use all the available claims providers.");

            // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                responseOfGetHierarchyAllResult.Length == providerNames.Count,
                219,
                @"[In GetHierarchyAll] The protocol server MUST retrieve claims provider hierarchy trees from claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support hierarchy.");

            Site.CaptureRequirementIfIsTrue(
                responseOfGetHierarchyAllResult.Length == providerNames.Count,
                239,
                @"[In GetHierarchyAllResponse]The protocol server MUST return one claims provider hierarchy tree for each claims provider that match the criteria specified in the input message.");
        }
        public void MSCPSWS_S02_TC02_GetHierarchy_ValidHierarchyNodeID()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            SPPrincipalType principalType   = SPPrincipalType.SharePointGroup;
            string          providerName    = null;
            string          hierarchyNodeID = null;

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                // Filter the providers, hierarchy providers which name is started with "_HierarchyProvider_" are not supported by GetHierarchy method.
                if (provider.ProviderName != null && !provider.ProviderName.StartsWith(Common.GetConfigurationPropertyValue("HierarchyProviderPrefix", this.Site)))
                {
                    providerName = provider.ProviderName;

                    foreach (SPProviderHierarchyNode children in provider.Children)
                    {
                        if (children.HierarchyNodeID != null)
                        {
                            hierarchyNodeID = children.HierarchyNodeID;
                        }
                    }

                    if (providerName != null && hierarchyNodeID != null)
                    {
                        break;
                    }
                }
            }

            Site.Assert.IsNotNull(providerName, "No such claim provider which have a hierarchyNodeID exists in the server!");
            Site.Assert.IsNotNull(hierarchyNodeID, "No such claim provider which have a hierarchyNodeID exists in the server!");

            // Call GetHierarchy method to get a claims provider hierarchy tree with a valid child hierarchyNodeID in the request.
            SPProviderHierarchyTree responseOfGetHierarchyResult = CPSWSAdapter.GetHierarchy(providerName, principalType, hierarchyNodeID, numberOfLevels);

            Site.Assert.AreEqual <string>("false", responseOfGetHierarchyResult.IsRoot.ToString().ToLower(CultureInfo.CurrentCulture), "Should return the hierarchyNodeID specified claims provider hierarchy tree, which is not existing root of current claims provider hierarchy tree.");

            // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                responseOfGetHierarchyResult.IsRoot.ToString().ToLower(CultureInfo.CurrentCulture) == "false",
                194,
                @"[In GetHierarchy] The protocol server MUST retrieve a claims provider hierarchy tree from the claims provider that meets all the following criteria:
The claims provider name is specified in the input message.
The claims provider is associated with the Web application (1) specified in the input message.
The claims provider supports hierarchy.");

            // If the providerName is not null, then the protocol server retrieve a hierarchy provider hierarchy tree in the input message, then the following requirement can be captured.
            Site.CaptureRequirementIfIsNotNull(
                providerName,
                194001,
                @"[In GetHierarchy] The protocol server MUST retrieve a hierarchy provider hierarchy tree if the name of an available hierarchy provider is specified in the input message.");
        }
Example #8
0
        public void MSCPSWS_S03_TC02_ProviderSchemas()
        {
            // Get the provider names of all the providers from the hierarchy
            ArrayOfString providerNames = new ArrayOfString();

            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();
            providerNames.AddRange(responseOfGetHierarchyAllResult.Select(root => root.ProviderName));
            foreach (SPProviderHierarchyNode node in responseOfGetHierarchyAllResult.SelectMany(root => root.Children))
            {
                this.DepthFirstTraverse(node, ref providerNames);
            }

            // Get schemas of the claims providers specified in the list of provider names in the request.
            SPProviderSchema[] responseOfProviderSchemaResult = CPSWSAdapter.ProviderSchemas(providerNames);
            Site.Assert.IsNotNull(responseOfProviderSchemaResult, "The schemas of the specific claims providers should not be null!");
        }
        public void MSCPSWS_S02_TC01_GetHierarchy_NullHierarchyNodeID()
        {
            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            SPPrincipalType principalType = SPPrincipalType.SharePointGroup;
            string          providerName  = null;

            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                // Filter the providers, hierarchy providers which name is started with "_HierarchyProvider_" are not supported by GetHierarchy method.
                if (!provider.ProviderName.StartsWith(Common.GetConfigurationPropertyValue("HierarchyProviderPrefix", this.Site)) && provider.Children.Length != 0)
                {
                    providerName = provider.ProviderName;
                    //Verify MS-CPSWS requirement: MS-CPSWS_R540001
                    Site.CaptureRequirementIfIsTrue(
                        provider.HierarchyNodeID.Length == 0,
                        540001,
                        @"[In SPProviderHierarchyElement] This value[HierarchyNodeID] is empty for the hierarchy provider and the root element of the hierarchy tree.");

                    if (providerName != null)
                    {
                        break;
                    }
                }
            }

            Site.Assume.IsNotNull(providerName, "The providerName should not be null!");

            // Call GetHierarchy method to get a claims provider hierarchy tree with a null hierarchyNodeID in the request.
            SPProviderHierarchyTree responseOfGetHierarchyResult = CPSWSAdapter.GetHierarchy(providerName, principalType, null, numberOfLevels);

            Site.Assert.AreEqual <string>("true", responseOfGetHierarchyResult.IsRoot.ToString().ToLower(CultureInfo.CurrentCulture), "Should return the existing root of current claims provider hierarchy tree.");

            // Verify MS-CPSWS requirement: MS-CPSWS_R209
            Site.CaptureRequirementIfAreEqual <string>(
                "true",
                responseOfGetHierarchyResult.IsRoot.ToString().ToLower(CultureInfo.CurrentCulture),
                209,
                @"[In GetHierarchy] hierarchyNodeID: If NULL is specified, then the protocol server MUST return the existing root of claims provider hierarchy tree.");
        }
        public void MSCPSWS_S01_TC03_ClaimTypes_ValidProviderName()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                ArrayOfString providerNames = new ArrayOfString();
                providerNames.Add(provider.ProviderName);

                // Call ClaimTypes method to get claim types with valid providerNames in the request.
                ArrayOfString responseOfClaimTypesResult = CPSWSAdapter.ClaimTypes(providerNames);
                Site.Assert.IsNotNull(responseOfClaimTypesResult, "If the providerNames is a valid providerNames, the protocol server MUST use the current available claims providers.");

                // Call GetClaimTypesResultBySutAdapter method to get claim types with valid providerNames in the request.
                ArrayOfString getClaimTypesResultBySutAdapter = GetClaimTypesResultBySutAdapter(providerNames);
                Site.Assert.IsTrue(this.VerificationSutResultsAndProResults(responseOfClaimTypesResult, getClaimTypesResultBySutAdapter), "The claim types returned by the protocol and script should be equal.");
            }
        }
        public void MSCPSWS_S02_TC07_GetHierarchyAll_ValidInputParameters()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] getAllProviders = TestSuiteBase.GetAllProviders();

            SPPrincipalType principalType = SPPrincipalType.User;

            // Get the valid numberOfLevels of claims provider hierarchy trees.
            int numberOfLevels = Convert.ToInt32(Common.GetConfigurationPropertyValue("numberOfLevels", Site));

            foreach (SPProviderHierarchyTree provider in getAllProviders)
            {
                ArrayOfString providerNames = new ArrayOfString();
                providerNames.Add(provider.ProviderName);

                // Call GetHierarchyAll method to get a list of claims provider hierarchy trees with a valid providerNames in the request.
                SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = CPSWSAdapter.GetHierarchyAll(providerNames, principalType, numberOfLevels);
                Site.Assert.IsNotNull(responseOfGetHierarchyAllResult, "If the provider names are valid, the protocol server will return the hierarchy trees that match the claims providers.");
            }
        }
        /// <summary>
        /// A method used to generate a valid input condition of SearchAll.
        /// </summary>
        public void GenerateSearchAllInput_Valid()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            TestSuiteBase.SearchPattern = null;

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                // Find the first provider tree with at least a child.
                if (provider.Children.Length != 0)
                {
                    // Get the child provider's name.
                    TestSuiteBase.SearchPattern = provider.Children[0].Nm;
                    break;
                }
            }

            return;
        }
        /// <summary>
        /// A method used to generate a valid SPClaim of ResolveInput which is used in the ResolveClaim operation.
        /// </summary>
        /// <returns>A return value represents the SPClaim of resolveInput.</returns>
        public SPClaim GenerateSPClaimResolveInput_Valid()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            SPClaim resolveInput = new SPClaim();

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                if (provider.Children.Length != 0)
                {
                    resolveInput.ClaimType      = provider.Children[0].HierarchyNodeID;
                    resolveInput.Value          = this.GenerateRandomString(5);
                    resolveInput.ValueType      = this.GenerateGUID();
                    resolveInput.OriginalIssuer = "ClaimProvider:" + provider.ProviderName;
                }
            }

            return(resolveInput);
        }
        public void MSCPSWS_S04_TC06_ResolveMultipleClaim_SomeValid()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.SecurityGroup;

            SPClaim[] resolveInput = new SPClaim[2];

            resolveInput[0] = this.GenerateSPClaimResolveInput_Valid();
            resolveInput[1] = this.GenerateSPClaimResolveInput_Invalid();

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                if (provider.Children.Length != 0)
                {
                    providerNames.Add(provider.ProviderName);
                }
            }

            // Call Resolve multiple claim method to resolve 2 claims to picker entities using a list of claims providers.
            PickerEntity[] responseOfResolveMultipleClaimResult = CPSWSAdapter.ResolveMultipleClaim(providerNames, principalType, resolveInput);
            Site.Assert.IsNotNull(responseOfResolveMultipleClaimResult, "The resolve multiple claim result should not be null.");

            // If the resolve multiple result contains 2 picker entities, that is to say, one picker entity in the response corresponding to one user in the request, then the following requirement can be captured.
            Site.CaptureRequirementIfAreEqual <int>(
                responseOfResolveMultipleClaimResult.Length,
                2,
                369,
                @"[In ResolveMultipleClaimResponse] ResolveMultipleClaimResult: The list MUST contain one and only one picker entity per one claim in the input.");

            Site.CaptureRequirementIfAreEqual <int>(
                responseOfResolveMultipleClaimResult.Length,
                2,
                350,
                @"[In ResolveMultipleClaim] The protocol server MUST resolve across all claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support resolve.");
        }
        public void MSCPSWS_S02_TC04_GetHierarchy_InvalidNumberOfLevels()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            SPPrincipalType principalType  = SPPrincipalType.SharePointGroup;
            int             numberOfLevels = 0;
            string          providerName   = null;

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                // Filter the providers, hierarchy providers which name is started with "_HierarchyProvider_" are not supported by GetHierarchy method.
                if (provider.ProviderName != null && !provider.ProviderName.StartsWith(Common.GetConfigurationPropertyValue("HierarchyProviderPrefix", this.Site)))
                {
                    providerName = provider.ProviderName;
                    break;
                }
            }

            bool caughtException = false;

            try
            {
                // Call GetHierarchy method with numberOfLevels parameter sets to invalid.
                CPSWSAdapter.GetHierarchy(providerName, principalType, null, numberOfLevels);
            }
            catch (FaultException faultException)
            {
                caughtException = true;

                // If the server returns an ArgumentNullException<""numberOfLevels""> message, then the following requirement can be captured.
                Site.CaptureRequirementIfIsTrue(
                    this.VerifyArgumentOutOfRangeException(faultException, "numberOfLevels"),
                    583,
                    @"[In GetHierarchy] The protocol server MUST return ArgumentOutOfRangeException<""numberOfLevels""> message if the value of this element [numberOfLevels] is less than 1.");
            }
            finally
            {
                this.Site.Assert.IsTrue(caughtException, "The protocol server should return ArgumentOutOfRangeException<numberOfLevels> message if the value of this element [numberOfLevels] is less than 1.");
            }
        }
        public void MSCPSWS_S04_TC01_ResolveString()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames    = new ArrayOfString();
            SPPrincipalType principalType    = SPPrincipalType.SecurityGroup;
            string          resolveInput     = string.Empty;
            bool            isResolveSuccess = false;

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                if (provider.EntityData.Length != 0)
                {
                    providerNames.Add(provider.ProviderName);

                    foreach (PickerEntity entityData in provider.EntityData)
                    {
                        resolveInput = entityData.DisplayText;

                        // Call Resolve method to resolve an input string to picker entities using a list of claims providers.
                        PickerEntity[] responseOfResolveResult = CPSWSAdapter.Resolve(providerNames, principalType, resolveInput);
                        Site.Assert.IsNotNull(responseOfResolveResult, "Resolve result should not null.");
                        isResolveSuccess = true;
                    }
                }
            }

            // If the claims providers listed in the provider names in the input message is resolved successfully, then the following requirement can be captured.
            Site.CaptureRequirementIfIsTrue(
                isResolveSuccess,
                280,
                @"[In Resolve] The protocol server MUST resolve across all claims providers that meet all the following criteria:
The claims providers are associated with the Web application specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support resolve.");
        }
        public void MSCPSWS_S04_TC04_ResolveMultipleStrings_SomeValid()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] allProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames = new ArrayOfString();
            SPPrincipalType principalType = SPPrincipalType.User;
            ArrayOfString   resolveInput  = new ArrayOfString();

            resolveInput.Add(Common.GetConfigurationPropertyValue("OwnerLogin", this.Site));
            resolveInput.Add(this.GenerateInvalidUser());

            foreach (SPProviderHierarchyTree provider in allProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            // Call Resolve multiple method to resolve 2 users to picker entities, one valid and another invalid.
            PickerEntity[] responseOfResolveMultipleResult = CPSWSAdapter.ResolveMultiple(providerNames, principalType, resolveInput);
            Site.Assert.IsNotNull(responseOfResolveMultipleResult, "The resolve multiple result should not be null.");

            // If the resolve multiple result contains 2 picker entities, that is to say, one picker entity in the response corresponding to one user in the request, then the following requirement can be captured.
            Site.CaptureRequirementIfAreEqual <int>(
                responseOfResolveMultipleResult.Length,
                2,
                345,
                @"[In ResolveMultipleResponse] The list [ResolveMultipleResult] MUST contain one and only one picker entity per string in the input.");

            Site.CaptureRequirementIfAreEqual <int>(
                responseOfResolveMultipleResult.Length,
                2,
                325,
                @"[In ResolveMultiple] The protocol server MUST resolve across all claims providers that meet all the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claims providers are listed in the provider names in the input message.
The claims providers support resolve.");
        }
        public void MSCPSWS_S05_TC04_SearchAll_nullSearchPattern()
        {
            // Get the provider names of all the providers from the hierarchy
            ArrayOfString providerNames = new ArrayOfString();

            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();
            providerNames.AddRange(responseOfGetHierarchyAllResult.Select(root => root.ProviderName));
            foreach (SPProviderHierarchyNode node in responseOfGetHierarchyAllResult.SelectMany(root => root.Children))
            {
                this.DepthFirstTraverse(node, ref providerNames);
            }

            // Set search principal Type.
            SPPrincipalType principalType = SPPrincipalType.SharePointGroup;

            // Get max count of matched entities allowed to return for this search.
            int maxCount = Convert.ToInt32(Common.GetConfigurationPropertyValue("MaxCount", Site));

            bool caughtException = false;

            try
            {
                // Set searchPattern as null and call searchAll.
                CPSWSAdapter.SearchAll(providerNames, principalType, null, maxCount);
            }
            catch (System.ServiceModel.FaultException faultException)
            {
                caughtException = true;

                // Verify Requirement 650, if the server returns an ArgumentNullException<"searchPattern"> message.
                Site.CaptureRequirementIfIsTrue(this.VerifyArgumentNullException(faultException, "searchPattern"), 650, @"[In SearchAll] If this [searchPattern] is NULL, the protocol server MUST return an ArgumentNullException<""searchPattern""> message.");
            }
            finally
            {
                this.Site.Assert.IsTrue(caughtException, "If searchPattern is NULL, the protocol server MUST return an ArgumentNullException<searchPattern> message.");
            }
        }
        public void MSCPSWS_S02_TC09_GetHierarchyAll_InvalidNumberOfLevels()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] getAllProviders = TestSuiteBase.GetAllProviders();

            ArrayOfString   providerNames  = new ArrayOfString();
            SPPrincipalType principalType  = SPPrincipalType.SharePointGroup;
            int             numberOfLevels = 0;

            foreach (SPProviderHierarchyTree provider in getAllProviders)
            {
                providerNames.Add(provider.ProviderName);
            }

            bool caughtException = false;

            try
            {
                // Call GetHierarchyAll method with numberOfLevels parameter sets to invalid.
                CPSWSAdapter.GetHierarchyAll(providerNames, principalType, numberOfLevels);
            }
            catch (FaultException faultException)
            {
                caughtException = true;

                // If the server returns an ArgumentNullException<""numberOfLevels""> message, then the following requirement can be captured.
                Site.CaptureRequirementIfIsTrue(
                    this.VerifyArgumentOutOfRangeException(faultException, "numberOfLevels"),
                    591,
                    @"[In GetHierarchyAll] The protocol server MUST return an ArgumentOutOfRangeException<""numberOfLevels""> message if the value of this element [numberOfLevels] is less than 1.");
            }
            finally
            {
                this.Site.Assert.IsTrue(caughtException, "The protocol server should return ArgumentOutOfRangeException<numberOfLevels> message if the value of this element [numberOfLevels] is less than 1.");
            }
        }
Example #20
0
        public void MSCPSWS_S01_TC02_ClaimTypes_AllValidProviderNames()
        {
            // Call the helper method to get all claims providers.
            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();

            ArrayOfString providerNames = new ArrayOfString();

            foreach (SPProviderHierarchyTree provider in responseOfGetHierarchyAllResult)
            {
                providerNames.Add(provider.ProviderName);
            }

            // Call ClaimTypes method to get claim types with all of valid providerNames in the request.
            ArrayOfString responseOfClaimTypesResult = CPSWSAdapter.ClaimTypes(providerNames);

            Site.Assert.IsNotNull(responseOfClaimTypesResult, "If the providerNames is all of valid providerNames, the protocol server MUST use all the available claims providers.");

            bool isNotDuplicate = VierfyRemoveDuplicate(responseOfClaimTypesResult);

            Site.CaptureRequirementIfIsTrue(
                isNotDuplicate,
                146001,
                @"[In ClaimTypes] The protocol server will remove the duplicated claim types from the known basic claim types and the claim providers’ claim types.");

            // Call GetClaimTypesResultBySutAdapter method to get claim types with all of valid providerNames in the request.
            ArrayOfString getClaimTypesResultBySutAdapter = GetClaimTypesResultBySutAdapter(providerNames);

            Site.Assert.IsTrue(this.VerificationSutResultsAndProResults(responseOfClaimTypesResult, getClaimTypesResultBySutAdapter), "The claim types returned by the protocol and script should be equal.");

            // If the claims providers listed in the provider names in the input message is retrieved successfully, then the following requirement can be captured.
            Site.CaptureRequirement(
                144,
                @"[In ClaimTypes] The protocol server MUST retrieve all known basic claim types. In addition, the protocol server MUST retrieve claim types from claims providers that meet both of the following criteria:
The claims providers are associated with the Web application (1) specified in the input message.
The claim providers are listed in the provider names in the input message.");
        }
 public static void ClassCleanup()
 {
     // Cleanup test site, must be called to ensure closing of logs.
     TestSuiteBase.TestSuiteClassCleanup();
 }
 public static void ClassInitialize(TestContext testContext)
 {
     TestSuiteBase.TestSuiteClassInitialize(testContext);
 }
        public void MSCPSWS_S05_TC03_SearchAll()
        {
            // Get the provider names of all the providers from the hierarchy
            ArrayOfString providerNames = new ArrayOfString();

            SPProviderHierarchyTree[] responseOfGetHierarchyAllResult = TestSuiteBase.GetAllProviders();
            providerNames.AddRange(responseOfGetHierarchyAllResult.Select(root => root.ProviderName));
            foreach (SPProviderHierarchyNode node in responseOfGetHierarchyAllResult.SelectMany(root => root.Children))
            {
                this.DepthFirstTraverse(node, ref providerNames);
            }

            // Set search principal Type.
            SPPrincipalType principalType = SPPrincipalType.SecurityGroup;

            // Get the searchPattern string as SearchAll input
            this.GenerateSearchAllInput_Valid();

            // Get max count of matched entities allowed to return for this search.
            int maxCount = Convert.ToInt32(Common.GetConfigurationPropertyValue("MaxCount", Site));

            Site.Assume.IsNotNull(TestSuiteBase.SearchPattern, "The search pattern should not be null!");

            // Search the first claims provider tree which has a child.
            SPProviderHierarchyTree[] responseOfSearchResult = CPSWSAdapter.SearchAll(providerNames, principalType, TestSuiteBase.SearchPattern, maxCount);

            // Requirement capture condition.
            bool searchAllSuccess = false;

            foreach (SPProviderHierarchyTree providerTree in responseOfSearchResult)
            {
                if (providerTree.ProviderName.StartsWith(Common.GetConfigurationPropertyValue("HierarchyProviderPrefix", this.Site)))
                {
                    if (providerNames.Contains(providerTree.ProviderName))
                    {
                        searchAllSuccess = true;
                    }
                    else
                    {
                        // Jump over the Hierarchy Provider tree that the server sees fit to return together with the result Claims provider trees.
                        continue;
                    }
                }
                else if (providerNames.Contains(providerTree.ProviderName))
                {
                    searchAllSuccess = true;
                }
                else
                {
                    Site.Assert.Fail("The provider names in the SearchAll result should be contained in the provider names in the input message!");
                }
            }

            // Capture requirement 417 by matching the input provider name with the result claims provider name,
            // The search input claims provider already satisfy the condition 1 and 3 in requirement 417 in test environment configuration.
            Site.CaptureRequirementIfIsTrue(
                searchAllSuccess,
                417,
                @"[In SearchAll] The protocol server MUST search across all claims providers that meet all the following criteria:
                The claims providers are associated with the Web application (1) specified in the input message.
                The claims providers are listed in the provider names in the input message.
                The claims providers support search.");
        }