public void MSFSSHTTP_FSSHTTPB_TestCase_S20_TC01_Properties_ErrorCode()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);
            string fileName = this.DefaultFileUrl.Substring(this.DefaultFileUrl.LastIndexOf("/", System.StringComparison.OrdinalIgnoreCase) + 1);

            PropertyIdType property = new PropertyIdType();

            property.id = fileName;
            PropertyIdType[] propertyId = new PropertyIdType[] { property };

            PropertiesSubRequestType propertiess = SharedTestSuiteHelper.CreatePropertiesSubRequest(SequenceNumberGenerator.GetCurrentToken(), PropertiesRequestTypes.PropertyGet, propertyId, this.Site);
            CellStorageResponse      response    = this.Adapter.CellStorageRequest(null, new SubRequestType[] { propertiess });

            if (Common.IsRequirementEnabled(2302011, this.Site))
            {
                PropertiesSubResponseType propertiesResponse = SharedTestSuiteHelper.ExtractSubResponse <PropertiesSubResponseType>(response, 0, 0, this.Site);
                SubResponseType           subresponse        = response.ResponseCollection.Response[0].SubResponse[0];

                if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
                {
                    // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2302011
                    Site.CaptureRequirementIfAreNotEqual <string>(
                        GenericErrorCodeTypes.Success.ToString(),
                        subresponse.ErrorCode,
                        "MS-FSSHTTP",
                        2302011,
                        @"[PropertiesSubResponseType]In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest. ");
                }
                else
                {
                    Site.Assert.AreNotEqual <string>(
                        GenericErrorCodeTypes.Success.ToString(),
                        subresponse.ErrorCode,
                        "In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest.");
                }
            }
        }
        /// <summary>
        /// Capture requirements related with Properties Sub-request.
        /// </summary>
        /// <param name="propertiesSubResponse">Containing the PropertiesSubResponse information</param>
        /// <param name="site">Instance of ITestSite</param>
        public static void ValidatePropertiesSubResponse(PropertiesSubResponseType propertiesSubResponse, ITestSite site)
        {
            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2305011
            site.CaptureRequirement(
                "MS-FSSHTTP",
                2305011,
                @"[PropertiesSubResponseType]
	<xs:complexType name=""PropertiesSubResponseType"">
	  <xs:complexContent>
	    <xs:extension base=""tns:SubResponseType"">
	      <xs:sequence minOccurs=""0"" maxOccurs=""1"">
	         <xs:element name=""SubResponseData"" type=""tns:PropertiesSubResponseDataType"" />
	      </xs:sequence>
	    </xs:extension>
	  </xs:complexContent>
	</xs:complexType>"    );

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2406
            site.CaptureRequirement(
                "MS-FSSHTTP",
                2406,
                @"[PropertiesSubResponseType]SubResponseData: A PropertiesSubResponseDataType that specifies the information about the properties for the resource that was requested as part of the Properties subrequest. ");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2393
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(PropertiesSubResponseType),
                propertiesSubResponse.GetType(),
                "MS-FSSHTTP",
                2393,
                @"[Properties Subrequest]The protocol server responds with a Properties SubResponse message, which is of type PropertiesSubResponseType as specified in section 2.3.1.55. ");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2148
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(PropertiesSubResponseType),
                propertiesSubResponse.GetType(),
                "MS-FSSHTTP",
                2148,
                @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: PropertiesSubResponseType");

            // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2166
            site.CaptureRequirementIfAreEqual <Type>(
                typeof(PropertiesSubResponseType),
                propertiesSubResponse.GetType(),
                "MS-FSSHTTP",
                2166,
                @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: PropertiesSubResponseType.");

            ErrorCodeType errorCode;

            site.Assert.IsTrue(Enum.TryParse <ErrorCodeType>(propertiesSubResponse.ErrorCode, true, out errorCode), "Fail to convert the error code string {0} to the Enum type ErrorCodeType", propertiesSubResponse.ErrorCode);
            if (errorCode == ErrorCodeType.Success)
            {
                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2160
                site.CaptureRequirementIfIsNotNull(
                    propertiesSubResponse.SubResponseData,
                    "MS-FSSHTTP",
                    2160,
                    @"[In SubResponseElementGenericType][The SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"" and one of the following conditions is true:] The Type attribute that is specified in the SubRequest element is set to a value of ""Properties"".");
            }

            // Verify requirements related with its base type: SubResponseType
            ValidateSubResponseType(propertiesSubResponse as SubResponseType, site);

            // Verify requirements related with SubResponseDataType
            if (propertiesSubResponse.SubResponseData != null)
            {
                ValidatePropertiesSubResponseDataType(propertiesSubResponse.SubResponseData, site);
            }
        }
Пример #3
0
        public void TestCase_S20_TC01_Properties_Success()
        {
            // Initialize the service
            this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain);

            string[]       ids        = new string[] { "RealtimeTypingEndpointUrl", "DocumentAccessToken", "DocumentAccessTokenTtl" };
            PropertyIdType propertyId = new PropertyIdType();

            PropertyIdType[] propertyIds = new PropertyIdType[3];

            for (int i = 0; i < ids.Length; i++)
            {
                propertyId.id  = ids[i];
                propertyIds[i] = propertyId;
            }

            PropertiesSubRequestType properties = SharedTestSuiteHelper.CreatePropertiesSubRequest(SequenceNumberGenerator.GetCurrentToken(), PropertiesRequestTypes.PropertyGet, propertyIds, this.Site);

            CellStorageResponse       cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { properties });
            PropertiesSubResponseType propertiesResponse  = SharedTestSuiteHelper.ExtractSubResponse <PropertiesSubResponseType>(cellStorageResponse, 0, 0, this.Site);
            SubResponseType           subresponse         = cellStorageResponse.ResponseCollection.Response[0].SubResponse[0];

            if (SharedContext.Current.IsMsFsshttpRequirementsCaptured)
            {
                // Capture the requirement MS-FSSHTTP_R246801
                Site.CaptureRequirement(
                    "MS-FSSHTTP",
                    246801,
                    @"[In Appendix B: Product Behavior] Implementation does support Properties operation. (SharePoint Server 2016 and above follow this behavior.)");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2301011
                Site.CaptureRequirementIfAreEqual <string>(
                    GenericErrorCodeTypes.Success.ToString(),
                    subresponse.ErrorCode,
                    "MS-FSSHTTP",
                    2301011,
                    @"[PropertiesSubResponseType]In the case of success, it contains information requested as part of a Properties subrequest. ");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2443
                Site.CaptureRequirementIfAreEqual <ErrorCodeType>(
                    ErrorCodeType.Success,
                    SharedTestSuiteHelper.ConvertToErrorCodeType(subresponse.ErrorCode, this.Site),
                    "MS-FSSHTTP",
                    2443,
                    @"[Properties Subrequest][The protocol server returns results based on the following conditions:]An ErrorCode value of ""Success"" indicates success in processing the Properties request.");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2447
                Site.CaptureRequirement(
                    "MS-FSSHTTP",
                    2447,
                    @"[Property Get]If the Properties attribute is set to ""PropertyGet"", the protocol server considers the Properties subrequest to be of type ""Property Get "". ");

                // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2299
                Site.CaptureRequirementIfIsNotNull(
                    propertiesResponse.SubResponseData.PropertyValues,
                    "MS-FSSHTTP",
                    2299,
                    @"[PropertiesSubResponseDataType][PropertyValues]This element MUST only be included in the response if the Properties attribute value is set to ""PropertyGet"".");
            }
            else
            {
                Site.Assert.AreEqual <string>(
                    GenericErrorCodeTypes.Success.ToString(),
                    subresponse.ErrorCode,
                    "[PropertiesSubResponseType]In the case of success, it contains information requested as part of a Properties subrequest. ");
            }
        }