예제 #1
0
        /// <summary>
        /// Verify the requirements of the complex type ListDefinitionCT.
        /// </summary>
        /// <param name="list">The actual ListDefinitionSchema which is an extension based on ListDefinitionCT.</param>
        private void VerifyListDefinitionCT(ListDefinitionCT list)
        {
            Site.Assert.IsNotNull(list, "The ListDefinitionCT cannot be null");

            // Verify R1347
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1347,
                @"[ ListDefinitionCT]Specifies information about a particular list.");

            // Verify R1348
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1348,
               @"[The schema of ListDefinitionCT is defined as:]<s:complexType name=""ListDefinitionCT"">
                  <s:complexType name=""ListDefinitionCT"">
                  <s:attribute name=""DocTemplateUrl"" type=""s:string"" />
                  <s:attribute name=""DefaultViewUrl"" type=""s:string"" use=""required"" />
                  <s:attribute name=""MobileDefaultViewUrl"" type=""s:string"" />
                  <s:attribute name=""ID"" type=""s:string"" use=""required"" />
                  <s:attribute name=""Title"" type=""s:string"" use=""required"" />
                  <s:attribute name=""Description"" type=""s:string"" />
                  <s:attribute name=""ImageUrl"" type=""s:string"" use=""required"" />
                  <s:attribute name=""Name"" type=""s:string"" use=""required"" />
                  <s:attribute name=""BaseType"" type=""s:string"" use=""required"" />
                  <s:attribute name=""FeatureId"" type=""s:string"" use=""required"" />
                  <s:attribute name=""ServerTemplate"" type=""s:string"" use=""required"" />
                  <s:attribute name=""Created"" type=""s:string"" use=""required"" />
                  <s:attribute name=""Modified"" type=""s:string"" use=""required"" />
                  <s:attribute name=""LastDeleted"" type=""s:string"" />
                  <s:attribute name=""Version"" type=""s:int"" use=""required"" />
                  <s:attribute name=""Direction"" type=""s:string"" use=""required"" />
                  <s:attribute name=""ThumbnailSize"" type=""s:string"" />
                  <s:attribute name=""WebImageWidth"" type=""s:string"" />
                  <s:attribute name=""WebImageHeight"" type=""s:string"" />
                  <s:attribute name=""Flags"" type=""s:int"" />
                  <s:attribute name=""ItemCount"" type=""s:int"" use=""required"" />
                  <s:attribute name=""AnonymousPermMask"" type=""unsignedLong"" />
                  <s:attribute name=""RootFolder"" type=""s:string"" />
                  <s:attribute name=""ReadSecurity"" type=""s:int"" use=""required"" />
                  <s:attribute name=""WriteSecurity"" type=""s:int"" use=""required"" />
                  <s:attribute name=""Author"" type=""s:string"" />
                  <s:attribute name=""EventSinkAssembly"" type=""s:string"" />
                  <s:attribute name=""EventSinkClass"" type=""s:string"" />
                  <s:attribute name=""EventSinkData"" type=""s:string"" />
                  <s:attribute name=""EmailInsertsFolder"" type=""s:string"" />
                  <s:attribute name=""EmailAlias"" type=""s:string"" />
                  <s:attribute name=""WebFullUrl"" type=""s:string"" />
                  <s:attribute name=""WebId"" type=""s:string"" />
                  <s:attribute name=""SendToLocation"" type=""s:string"" />
                  <s:attribute name=""ScopeId"" type=""s:string"" />
                  <s:attribute name=""MajorVersionLimit"" type=""s:int"" />
                  <s:attribute name=""MajorWithMinorVersionsLimit"" type=""s:int"" />
                  <s:attribute name=""WorkFlowId"" type=""s:string"" />
                  <s:attribute name=""HasUniqueScopes"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""NoThrottleListOperations"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""HasRelatedLists"" type=""s:string"" />
                  <s:attribute name=""AllowDeletion"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""AllowMultiResponses"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""EnableAttachments"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""EnableModeration"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""EnableVersioning"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""HasExternalDataSource"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""Hidden"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""MultipleDataList"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""Ordered"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""ShowUser"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""EnablePeopleSelector"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""EnableResourceSelector"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""EnableMinorVersion"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""RequireCheckout"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""ThrottleListOperations"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""ExcludeFromOfflineClient"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""CanOpenFileAsync"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""EnableFolderCreation"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""IrmEnabled"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""IsApplicationList"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""PreserveEmptyValues"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""StrictTypeCoercion"" type=""core:TRUEFALSE"" />
                  <s:attribute name=""EnforceDataValidation"" type=""core:TRUEFALSE"" use=""optional""/>
                  <s:attribute name=""MaxItemsPerThrottledOperation"" type=""s:int"" />
                  <s:attribute name=""EnableAssignedToEmail"" type=""core:TRUEFALSE"" use=""optional""/>
                  <s:attribute name=""Followable"" type=""core:TRUEFALSE"" />
                  </s:complexType> ");

            if (Common.IsRequirementEnabled(5417, this.Site))
            {
                this.Site.CaptureRequirementIfIsNull(
                  list.Followable,
                  5417,
                  @"Implementation does not return this attribute[ListDefinitionCT.Followable]. [In Appendix B: Product Behavior] <16> Section 2.2.4.11: This attribute[ListDefinitionCT.Followable] is not returned in Windows SharePoint Services 3.0 and SharePoint Foundation 2010.");
            }

            // Verify MS-LISTSWS requirement: MS-LISTSWS_R1352
            // If the ID can be used to create a Guid, then the following requirement 
            // can be captured.
            Guid id;
            bool isVerifyR1352 = Guid.TryParse(list.ID, out id);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1352,
                1352,
                @"[ListDefinitionCT.ID is ]The GUID[ for the list.]");

            Guid guidOfList = new Guid();
            if (!string.IsNullOrEmpty(list.FeatureId))
            {
                // Verify MS-LISTSWS requirement: MS-LISTSWS_R2236
                Site.CaptureRequirementIfIsTrue(
                    Guid.TryParse(list.FeatureId, out guidOfList),
                    2236,
                    @"[ListDefinitionCT.ID:] The GUID for the list.");

                // Verify MS-LISTSWS requirement: MS-LISTSWS_R2238
                // If the FeatureID can be used to create a Guid, then the following 
                // requirement can be captured.
                bool isVerifyR2238 = Guid.TryParse(list.FeatureId, out id);

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR2238,
                    2238,
                    @"[ListDefinitionCT.FeatureID is] The GUID [of the feature that contains the list "
                    + "schema for the list]");
            }

            // Verify MS-LISTSWS requirement: MS-LISTSWS_R1356
            // If the Name can be used to create a Guid, then the following requirement 
            // can be captured.
            bool isVerifyR1356 = Guid.TryParse(list.Name, out id);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1356,
                1356,
                @"[ListDefinitionCT.Name is ]The internal name for the list.");

            //Verify MS-LISTSWS requirement: MS-LISTSWS_R1356001
            Site.Assert.IsTrue(list.Name == list.ID, "The Name is equal to ID.");
            Site.CaptureRequirement(
                1356001,
                @"[ListDefinitionCT.Name] The Name is equal to ID.");

            // Verify MS-LISTSWS requirement: MS-LISTSWS_R52.
            // If the actual BaseType value is contained in the expected domain of 
            // values, then the requirement can be captured.
            string[] baseTypeDomain = { "-1", "0", "1", "3", "4", "5" };

            Site.CaptureRequirementIfIsTrue(
                new List<string>(baseTypeDomain).Contains(list.BaseType),
                52,
                @"[ListDefinitionCT.BaseType] See [MS-WSSFO2] section 2.2.3.11 for the possible "
                + "values of the BaseType."
                + "[The only valid values of the List Base Type are specified as follows."
                + "    "
                + "Value  Description"
                + "0      Generic list"
                + "1      Document library"
                + "3      Discussion board list"
                + "4      Survey list"
                + "5      Issues list]");

            // Verify MS-LISTSWS requirement: MS-LISTSWS_R1358
            Guid guidOfFeature = new Guid();
            Site.CaptureRequirementIfIsTrue(
                Guid.TryParse(list.ID, out guidOfFeature),
                1358,
                @"[ListDefinitionCT.FeatureID] The GUID of the feature that contains the list "
                + "schema for the list.");

            // Verify MS-LISTSWS requirement: MS-LISTSWS_R1361
            // If the Created can be parsed to a DateTime, then the following 
            // requirement can be captured.
            DateTime created;
            string parseFormat = @"yyyyMMdd HH:mm:ss";
            bool isVerifyR1361 = DateTime.TryParseExact(list.Created, parseFormat, CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out created);

            Site.Log.Add(
                LogEntryKind.Debug,
                "The actual values: list.Created[{0}] for requirement #R1361",
                string.IsNullOrEmpty(list.Created) ? "NullOrEmpty" : list.Created);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1361,
                1361,
                @"ListDefinitionCT.Created: Specifies the Coordinated Universal Time (UTC) date "
                + "and time in the Gregorian calendar when the list was created in the format "
                + @"""yyyyMMdd hh:mm:ss"" where ""yyyy"" represents the year, ""MM"" "
                + @"represents the month, ""dd"" represents the day of the month, ""hh"" "
                + @"represents the hour, ""mm"" represents the minute, and ""ss"" represents the "
                + "second.");

            // Verify MS-LISTSWS requirement: MS-LISTSWS_R1362
            // If the Modified can be parsed to a DateTime, then the following 
            // requirement can be captured.
            bool isVerifyR1362 = DateTime.TryParseExact(list.Created, parseFormat, CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out created);

            Site.Log.Add(
             LogEntryKind.Debug,
             "The actual values: list.Created[{0}] for requirement #R1362",
             string.IsNullOrEmpty(list.Created) ? "NullOrEmpty" : list.Created);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1362,
                1362,
                @"[ListDefinitionCT.Modified: ]Specifies the Coordinated Universal Time (UTC) date "
                + "and time in the Gregorian calendar when the list was last modified in the format "
                + @"""yyyyMMdd hh:mm:ss"" where ""yyyy"" represents the year, ""MM"" represents "
                + @"the month, ""dd"" represents the day of the month, ""hh"" represents the hour, "
                + @"""mm"" represents the minute, and ""ss"" represents the second.");

            // Verify R1363
            if (!string.IsNullOrEmpty(list.LastDeleted))
            {
                // Verify MS-LISTSWS requirement: MS-LISTSWS_R1363
                // If the LastDeleted can be parsed to a DateTime, then the following 
                // requirement can be captured.
                bool isR1363 = DateTime.TryParseExact(list.Created, parseFormat, CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out created);

                Site.Log.Add(
                 LogEntryKind.Debug,
                 "The actual values: list.Created[{0}] for requirement #R1363",
                 string.IsNullOrEmpty(list.Created) ? "NullOrEmpty" : list.Created);

                Site.CaptureRequirementIfIsTrue(
                    isR1363,
                    1363,
                    @"[ListDefinitionCT.LastDeleted: ]Specifies the Coordinated Universal Time (UTC) "
                    + "date and time in the Gregorian calendar when the list last had an element "
                    + @"deleted in the format ""yyyyMMdd hh:mm:ss"" where""'yyyy"" represents the "
                    + @"year, ""MM"" represents the month, ""dd"" represents the day of the month, "
                    + @"""hh"" represents the hour, ""mm"" represents the minute, and ""ss"" "
                    + "represents the second.");
            }

            // Verify R1365
            // The response have been received successfully, then the following requirement can be captured.
            // If the response is not received and parsed successfully, the test case will fail before this requirement is captured 
            Site.CaptureRequirement(
                1365,
                @"[ListDefinitionCT.Direction: ]Specifies the direction that items in the list are laid "
                + "out in when displayed.");

            // Verify MS-LISTSWS requirement: MS-LISTSWS_R121.
            // If the actual Direction value is contained in the expected domain of 
            // values, then the requirement can be captured.
            string[] directionDomain = { "none", "ltr", "rtl" };
            Site.CaptureRequirementIfIsTrue(
                new List<string>(directionDomain).Contains(list.Direction),
                121,
                @"[ListDefinitionCT.Direction] MUST be one of the following values: none ltr, rtl.");

            // Verify MS-LISTSWS requirement: MS-LISTSWS_R141.
            // If the actual ReadSecurity value is contained in the expected domain of 
            // values, then the requirement can be captured.
            bool isVerifyR141 = (list.ReadSecurity == 1) || (list.ReadSecurity == 2);
            Site.CaptureRequirementIfIsTrue(
                isVerifyR141,
                141,
                @"[ListDefinitionCT.ReadSecurity] The read permission setting for this list MUST "
                + "be one of the following values: 1, 2.");

            // Verify MS-LISTSWS requirement: MS-LISTSWS_R144.
            // If the actual WriteSecurity value is contained in the expected domain of 
            // values, then the requirement can be captured.
            bool isVerifyR144 = (list.WriteSecurity == 1) || (list.WriteSecurity == 2)
                || (list.WriteSecurity == 4);
            Site.CaptureRequirementIfIsTrue(
                isVerifyR144,
                144,
                @"[ListDefinitionCT.WriteSecurity] The write permission setting for this list MUST "
                + "be one of the following values: 1, 2, 4.");

            // Verify R2239
            if (!string.IsNullOrEmpty(list.WebId))
            {
                // Verify MS-LISTSWS requirement: MS-LISTSWS_R2239
                // If the WebId can be used to create a Guid, then the following 
                // requirement can be captured.
                bool isVerifyR2239 = Guid.TryParse(list.WebId, out id);

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR2239,
                    2239,
                    @"[ListDefinitionCT.WebId is] The GUID [of the site that this list is associated with.]");
            }

            // Verify R2240
            if (!string.IsNullOrEmpty(list.ScopeId))
            {
                // Verify MS-LISTSWS requirement: MS-LISTSWS_R2240
                // If the ScopeId can be used to create a Guid, then the following 
                // requirement can be captured.
                bool isVerifyR2240 = Guid.TryParse(list.ScopeId, out id);

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR2240,
                    2240,
                    @"[ListDefinitionCT.ScopeId is]The GUID [of the site that contains this list]");
            }

            // Verify R2241
            if (!string.IsNullOrEmpty(list.WorkFlowId))
            {
                // Verify MS-LISTSWS requirement: MS-LISTSWS_R2241
                // If the ScopeId can be used to create a Guid, then the following 
                // requirement can be captured.
                bool isVerifyR2241 = Guid.TryParse(list.WorkFlowId, out id);

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR2241,
                    2241,
                    @"[ListDefinitionCT.WorkFlowId is] The GUID [of a workflow association that is used "
                    + "to manage the Content Approval process for the list.]");
            }

            // Verify R1208
            // If all the above requirements are verified, then the requirement can be 
            // captured.
            Site.CaptureRequirement(
                1208,
                @"[In Complex Types]The Complex type ListDefinitionCT is used Specifies information "
                + "about a particular list.");

            if (Common.IsRequirementEnabled(2396, this.Site))
            {
                // Verify R2396
                Site.CaptureRequirementIfIsNull(
                    list.HasExternalDataSource,
                    2396,
                    @"Implementation does not return this attribute[ListDefinitionCT.HasExternalDataSource]. [In Appendix B: Product Behavior] <4> Section 2.2.4.11: This attribute[ListDefinitionCT.HasExternalDataSource] is not returned by Windows SharePoint Services 3.0 servers.");
            }

            if (Common.IsRequirementEnabled(2398, this.Site))
            {
                // Verify R2398
                Site.CaptureRequirementIfIsNull(
                    list.EnablePeopleSelector,
                    2398,
                    @"Implementation does not return this attribute[ListDefinitionCT.EnablePeopleSelector]. [In Appendix B: Product Behavior] <5> Section 2.2.4.11: This attribute[ListDefinitionCT.EnablePeopleSelector] is not returned by Windows SharePoint Services 3.0 servers.");
            }

            if (Common.IsRequirementEnabled(2400, this.Site))
            {
                // Verify R2400
                Site.CaptureRequirementIfIsNull(
                    list.EnableResourceSelector,
                    2400,
                    @"Implementation does not return this attribute[ListDefinitionCT.EnableResourceSelector]. [In Appendix B: Product Behavior] <6> Section 2.2.4.11: This attribute[ListDefinitionCT.EnableResourceSelector] is not returned by Windows SharePoint Services 3.0 servers.");
            }

            if (Common.IsRequirementEnabled(2402, this.Site))
            {
                // Verify R2402
                Site.CaptureRequirementIfIsNull(
                    list.ExcludeFromOfflineClient,
                    2402,
                    @"Implementation does not return this attribute[ListDefinitionCT.ExcludeFromOfflineClient]. [In Appendix B: Product Behavior] <7> Section 2.2.4.11: This attribute[ListDefinitionCT.ExcludeFromOfflineClient] is not returned by Windows SharePoint Services 3.0 servers.");
            }
            if (Common.IsRequirementEnabled(1401002002, this.Site))
            { 
                //Verify 1401002002
                Site.CaptureRequirementIfIsNull(
                    list.CanOpenFileAsync,
                    1401002002,
                    @"Implementation does not return to the client, when the client attempts to open files asynchronously from the server. (SharePoint Foundation 2010 follows this behavior.)");
            }
            if (Common.IsRequirementEnabled(1401002001, this.Site))
            {
                //Verify 1401002001
                Site.CaptureRequirementIfIsNotNull(
                    list.CanOpenFileAsync,
                    1401002001,
                    @"Implementation does return to the client, when the client attempts to open files asynchronously from the server. (SharePoint Foundation 2013 and SharePoint Server 2016 follow this behavior.)");

                //Verify requirement: MS-LISTSWS_R1401001
                Site.CaptureRequirementIfIsNotNull
                    (
                    list.CanOpenFileAsync,
                    1401001,
                    @"[ListDefinitionCT.CanOpenFileAsync:] True, if the client attempts to open files asynchronously from the server.");

            }
            if (Common.IsRequirementEnabled(2404, this.Site))
            {
                // Verify R2404
                Site.CaptureRequirementIfIsNull(
                    list.EnableFolderCreation,
                    2404,
                    @"Implementation does not return this attribute[ListDefinitionCT.EnableFolderCreation]. [In Appendix B: Product Behavior]<9> Section 2.2.4.11: This attribute is not returned by Windows SharePoint Services 3.0 servers.");
            }

            if (Common.IsRequirementEnabled(2406, this.Site))
            {
                // Verify R2406
                Site.CaptureRequirementIfIsNull(
                    list.IrmEnabled,
                    2406,
                    @"Implementation does not return this attribute[ListDefinitionCT.IrmEnabled]. [In Appendix B: Product Behavior] <10> Section 2.2.4.11: This attribute[ListDefinitionCT.IrmEnabled] is not returned in Windows SharePoint Services 3.0.");
            }

            if (Common.IsRequirementEnabled(2408, this.Site))
            {
                // Verify R2408
                Site.CaptureRequirementIfIsNull(
                    list.IsApplicationList,
                    2408,
                    @"Implementation does not return this attribute[ListDefinitionCT.IsApplicationList]. [In Appendix B: Product Behavior] <11> Section 2.2.4.11: This attribute[ListDefinitionCT.IsApplicationList] is not returned in Windows SharePoint Services 3.0.");
            }

            if (Common.IsRequirementEnabled(2410, this.Site))
            {
                // Verify R2410
                Site.CaptureRequirementIfIsNull(
                    list.PreserveEmptyValues,
                    2410,
                    @"Implementation does not return this attribute[ListDefinitionCT.PreserveEmptyValues]. [In Appendix B: Product Behavior] <12> Section 2.2.4.11: This attribute[ListDefinitionCT.PreserveEmptyValues] is not returned in Windows SharePoint Services 3.0.");
            }

            if (Common.IsRequirementEnabled(2412, this.Site))
            {
                // Verify R2412
                Site.CaptureRequirementIfIsNull(
                    list.StrictTypeCoercion,
                    2412,
                    @"Implementation does not return this attribute[ListDefinitionCT.StrictTypeCoercion]. [In Appendix B: Product Behavior] <13> Section 2.2.4.11: This attribute[ListDefinitionCT.StrictTypeCoercion] is not returned in Windows SharePoint Services 3.0.");
            }

            if (Common.IsRequirementEnabled(2414, this.Site))
            {
                // Verify R2414
                Site.CaptureRequirementIfIsFalse(
                    list.MaxItemsPerThrottledOperationSpecified,
                    2414,
                    @"Implementation does not return this attribute[ListDefinitionCT.MaxItemsPerThrottledOperation]. [In Appendix B: Product Behavior] <14> Section 2.2.4.11: This attribute[ListDefinitionCT.MaxItemsPerThrottledOperation] is not returned in Windows SharePoint Services 3.0.");
            }

            if (Common.IsRequirementEnabled(2416, this.Site))
            {
                // Verify R2416
                Site.CaptureRequirementIfIsNull(
                    list.EnforceDataValidation,
                    2416,
                    @"Implementation does not return this attribute[ListDefinitionCT.EnforceDataValidation]. [In Appendix B: Product Behavior] <15> Section 2.2.4.11: This attribute[ListDefinitionCT.EnforceDataValidation] is not returned in Windows SharePoint Services 3.0.");
            }
        }