/// <summary> /// Capture requirements for Scope structure /// </summary> /// <param name="scopes">Scope structure</param> /// <param name="site">A instance of ITestSite.</param> public static void CaptureScopesElementRequirements(ScopesType scopes, ITestSite site) { // Add debug info site.Log.Add(LogEntryKind.Debug, "Scopes: {0}", scopes); site.CaptureRequirementIfIsNotNull( scopes, 55, @"[In Scopes] Each element in the list is actually a UTF-8-encoded string representation of the HoHoDk value in hexBinary format [XMLSCHEMA1.1/2] [and represents one segment]."); // Add debug info site.Log.Add(LogEntryKind.Debug, "Scopes: {0}", scopes); site.CaptureRequirementIfIsTrue( scopes.Text.Length > 0, 158, @"[The <Scopes> element represents the list of discovery provider scopes, where] each element in the list is a string."); }
/// <summary> /// Verify ObjectGroupObjectData for the Root node object group related requirements. /// </summary> /// <param name="objectGroupObjectData">Specify the objectGroupObjectData instance.</param> /// <param name="rootDeclare">Specify the root declare instance.</param> /// <param name="objectGroupList">Specify all the ObjectGroupDataElementData list.</param> /// <param name="site">Specify the ITestSite instance.</param> public static void VerifyObjectGroupObjectDataForRootNode(ObjectGroupObjectData objectGroupObjectData, ObjectGroupObjectDeclare rootDeclare, List<ObjectGroupDataElementData> objectGroupList, ITestSite site) { #region Verify the Object Group Object Data // Object Extended GUID Array : Specifies an ordered list of the Object Extended GUIDs for each child of the Root Node. ExGUIDArray childObjectExGuidArray = objectGroupObjectData.ObjectExGUIDArray; if (childObjectExGuidArray != null && childObjectExGuidArray.Count.DecodedValue != 0) { // Run here successfully, then capture the requirement MS-FSSHTTPD_R8009, MS-FSSHTTPD_R8005 and MS-FSSHTTPD_R8006. site.CaptureRequirement( "MS-FSSHTTPD", 8005, @"[In Common Node Object Properties][Root of Object Extended GUID Array field] Specifies an ordered list of the Object Extended GUIDs for each child of the Root Node. "); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8006 site.CaptureRequirement( "MS-FSSHTTPD", 8006, @"[In Common Node Object Properties][Root of Object Extended GUID Array field] Object Extended GUID Array entries MUST be ordered based on the sequential file bytes represented by each Node Object."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8009 site.CaptureRequirement( "MS-FSSHTTPD", 8009, @"[In Common Node Object Properties][Root of Object Extended GUID field] An extended GUID, as specified in [MS-FSSHTTPB] section 2.2.1.7."); foreach (ExGuid guid in childObjectExGuidArray.Content) { bool isUnique = IsGuidUnique(guid, objectGroupList); site.Log.Add(LogEntryKind.Debug, "Whether the Object Extended GUID is unique:{0}", isUnique); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8101 site.CaptureRequirementIfIsTrue( isUnique, "MS-FSSHTTPD", 8101, @"[In Common Node Object Properties][Root of Object Extended GUID field] This GUID[Object Extended GUID] MUST be different within this file in once response."); } } // Cell ID Array : Specifies an empty list of Cell IDs. CellIDArray cellIDArray = objectGroupObjectData.CellIDArray; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The count of Cell ID Array is:{0}", cellIDArray.Count); // If the Cell ID Array is an empty list, indicates that the count of the array is 0. // So capture these requirements. // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R4 site.CaptureRequirementIfAreEqual<ulong>( 0, cellIDArray.Count, "MS-FSSHTTPD", 4, @"[In Common Node Object Properties][Root of Cell ID Array field] Specifies an empty list of Cell IDs."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R50 site.CaptureRequirementIfAreEqual<ulong>( 0, cellIDArray.Count, "MS-FSSHTTPD", 50, @"[In Root Node Object Cell References] The Cell ID Array, as specified in [MS-FSSHTTPB] section 2.2.1.12.6.4, of the Root Node Object MUST specify an empty array."); #endregion #region Verify the Object Group Object Declaration // Object Extended GUID : An extended GUID which specifies an identifier for this object. This GUID MUST be unique within this file. ExGuid currentObjectExGuid = rootDeclare.ObjectExtendedGUID; // Check whether Object Extended GUID is unique. bool isGuidUnique = IsGuidUnique(currentObjectExGuid, objectGroupList); // Add the log information. site.Log.Add(LogEntryKind.Debug, "Whether the Object Extended GUID is unique:{0}", isGuidUnique); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8103 site.CaptureRequirementIfIsTrue( isGuidUnique, "MS-FSSHTTPD", 8103, @"[In Common Node Object Properties][Data of Object Extended GUID field] This GUID[Object Extended GUID] MUST be different within this file in once response."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R75 site.CaptureRequirementIfIsTrue( isGuidUnique, "MS-FSSHTTPD", 75, @"[In Cell Properties] For each stream, a single Root Node MUST be specified by using a unique root identifier."); // Object Partition ID : A compact unsigned 64-bit integer which MUST be 1. Compact64bitInt objectPartitionID = rootDeclare.ObjectPartitionID; // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R17 site.Assert.IsTrue(typeof(Compact64bitInt).Equals(objectPartitionID.GetType()), "The type of objectPartitionID should be a compact unsigned 64-bit integer."); site.Assert.IsTrue(objectPartitionID.DecodedValue == 1, "The actual value of objectPartitionID should be 1."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R17 site.CaptureRequirement( "MS-FSSHTTPD", 17, @"[In Common Node Object Properties][Root of Object Partition ID field] A compact unsigned 64-bit integer that MUST be ""1""."); // Object Data Size :A compact unsigned 64-bit integer which MUST be the size of the Object Data field. Compact64bitInt objectDataSize = rootDeclare.ObjectDataSize; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The value of Object Data Size is:{0}", objectDataSize.DecodedValue); site.Assert.IsTrue(typeof(Compact64bitInt).Equals(objectDataSize.GetType()), "The type of objectPartitionID should be a compact unsigned 64-bit integer."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R20 site.CaptureRequirement( "MS-FSSHTTPD", 20, @"[In Common Node Object Properties][Root of Object Data Size field] A compact unsigned 64-bit integer that MUST be the size of the Object Data field."); // Object References Count : A compact unsigned 64-bit integer that specifies the number of object references. Compact64bitInt objectReferencesCount = rootDeclare.ObjectReferencesCount; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The count of Object References is:{0}", objectReferencesCount.DecodedValue); site.Assert.IsTrue(typeof(Compact64bitInt).Equals(objectReferencesCount.GetType()), "The type of objectReferencesCount should be a compact unsigned 64-bit integer."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R23 site.CaptureRequirement( "MS-FSSHTTPD", 23, @"[In Common Node Object Properties][Root of Object References Count field] A compact unsigned 64-bit integer that specifies the number of object references."); // Cell References Count : A compact unsigned 64-bit integer which MUST be 0. Compact64bitInt cellReferencesCount = rootDeclare.CellReferencesCount; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The value of Cell References is:{0}", cellReferencesCount.DecodedValue); site.Assert.IsTrue(typeof(Compact64bitInt).Equals(cellReferencesCount.GetType()), "The type of cellReferencesCount should be a compact unsigned 64-bit integer."); site.Assert.IsTrue(cellReferencesCount.DecodedValue == 0, "The value of cellReferencesCount should be 0."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R26 site.CaptureRequirement( "MS-FSSHTTPD", 26, @"[In Common Node Object Properties][Root of Cell References Count field] A compact unsigned 64-bit integer that MUST be zero."); #endregion // Run here successfully, then capture the requirement MS-FSSHTTPD_R8002 and MS-FSSHTTPD_R8004. site.CaptureRequirement( "MS-FSSHTTPD", 8002, @"[In Common Node Object Properties] A Node Object is contained within an object group data element."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8004 site.CaptureRequirement( "MS-FSSHTTPD", 8004, @"[In Common Node Object Properties] The Object Group Object Data field MUST be set as shown in the following table, as specified in [MS-FSSHTTPB] section 2.2.1.12.6.4"); }
/// <summary> /// Verify ObjectGroupObjectData for the Intermediate node object group related requirements. /// </summary> /// <param name="objectGroupObjectData">Specify the objectGroupObjectData instance.</param> /// <param name="intermediateDeclare">Specify the intermediate declare instance.</param> /// <param name="objectGroupList">Specify all the ObjectGroupDataElementData list.</param> /// <param name="site">Specify the ITestSite instance.</param> public static void VerifyObjectGroupObjectDataForIntermediateNode(ObjectGroupObjectData objectGroupObjectData, ObjectGroupObjectDeclare intermediateDeclare, List<ObjectGroupDataElementData> objectGroupList, ITestSite site) { #region Verify the Object Group Object Data ExGUIDArray childObjectExGuidArray = objectGroupObjectData.ObjectExGUIDArray; if (childObjectExGuidArray != null && childObjectExGuidArray.Count.DecodedValue != 0) { // If the intermediate node can be build then verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R65 site.CaptureRequirement( "MS-FSSHTTPD", 65, @"[In Intermediate Node Object References] The Object Extended GUID Array, as specified in [MS-FSSHTTPB] section 2.2.1.12.6.4, of the Intermediate Node Object MUST specify an ordered set of Object Extended GUIDs."); // If the intermediate node can be build then verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8007 and MS-FSSHTTPD_R8008 site.CaptureRequirement( "MS-FSSHTTPD", 8007, @"[In Common Node Object Properties][Intermediate of Object Extended GUID Array field] Specifies an ordered list of the Object Extended GUIDs for each child of this Node."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8008 site.CaptureRequirement( "MS-FSSHTTPD", 8008, @"[In Common Node Object Properties][Intermediate of Object Extended GUID Array field] Object Extended GUID Array entries MUST be ordered based on the sequential file bytes represented by each Node Object."); } // Cell ID Array : Specifies an empty list of Cell IDs. CellIDArray cellIDArray = objectGroupObjectData.CellIDArray; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The count of Cell ID Array is:{0}", cellIDArray.Count); // If the Cell ID Array is an empty list, indicates that the count of the array is 0. // So capture these requirements. // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R5 site.CaptureRequirementIfAreEqual<ulong>( 0, cellIDArray.Count, "MS-FSSHTTPD", 5, @"[In Common Node Object Properties][Intermediate of Cell ID Array field] Specifies an empty list of Cell IDs."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R67 site.CaptureRequirementIfAreEqual<ulong>( 0, cellIDArray.Count, "MS-FSSHTTPD", 67, @"[In Intermediate Node Object Cell References] The Cell Reference Array of the Object MUST specify an empty array."); #endregion #region Verify the Object Group Object Declaration // Object Extended GUID : An extended GUID which specifies an identifier for this object. This GUID MUST be unique within this file. ExGuid currentObjectExGuid = intermediateDeclare.ObjectExtendedGUID; // Check whether Object Extended GUID is unique. bool isVerify8102 = IsGuidUnique(currentObjectExGuid, objectGroupList); // Add the log information. site.Log.Add(LogEntryKind.Debug, "Whether the Object Extended GUID is unique:{0}", isVerify8102); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8102 site.CaptureRequirementIfIsTrue( isVerify8102, "MS-FSSHTTPD", 8102, @"[In Common Node Object Properties][Intermediate of Object Extended GUID Field] This GUID[Object Extended GUID] MUST be different within this file in once response."); // Object Partition ID : A compact unsigned 64-bit integer which MUST be 1. Compact64bitInt objectPartitionID = intermediateDeclare.ObjectPartitionID; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The value of Object Partition ID is:{0}", objectPartitionID.DecodedValue); site.Assert.IsTrue(typeof(Compact64bitInt).Equals(objectPartitionID.GetType()), "The type of objectPartitionID should be a compact unsigned 64-bit integer."); site.Assert.IsTrue(objectPartitionID.DecodedValue == 1, "The actual value of objectPartitionID should be 1."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R18 site.CaptureRequirement( "MS-FSSHTTPD", 18, @"[In Common Node Object Properties][Intermediate of Object Partition ID field] A compact unsigned 64-bit integer that MUST be ""1""."); // Object Data Size :A compact unsigned 64-bit integer which MUST be the size of the Object Data field. Compact64bitInt objectDataSize = intermediateDeclare.ObjectDataSize; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The value of Object Data Size is:{0}", objectDataSize.DecodedValue); site.Assert.IsTrue(typeof(Compact64bitInt).Equals(objectDataSize.GetType()), "The type of objectPartitionID should be a compact unsigned 64-bit integer."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R21 site.CaptureRequirement( "MS-FSSHTTPD", 21, @"[In Common Node Object Properties][Intermediate of Object Data Size field] A compact unsigned 64-bit integer that MUST be the size of the Object Data field."); // Object References Count : A compact unsigned 64-bit integer that specifies the number of object references. Compact64bitInt objectReferencesCount = intermediateDeclare.ObjectReferencesCount; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The count of Object References is:{0}", objectReferencesCount.DecodedValue); site.Assert.IsTrue(typeof(Compact64bitInt).Equals(objectReferencesCount.GetType()), "The type of objectReferencesCount should be a compact unsigned 64-bit integer."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R24 site.CaptureRequirement( "MS-FSSHTTPD", 24, @"[In Common Node Object Properties][Intermediate of Object References Count field] A compact unsigned 64-bit integer that specifies the number of object references."); // Cell References Count : A compact unsigned 64-bit integer which MUST be 0. Compact64bitInt cellReferencesCount = intermediateDeclare.CellReferencesCount; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The value of Cell References is:{0}", cellReferencesCount.DecodedValue); site.Assert.IsTrue(typeof(Compact64bitInt).Equals(cellReferencesCount.GetType()), "The type of cellReferencesCount should be a compact unsigned 64-bit integer."); site.Assert.IsTrue(cellReferencesCount.DecodedValue == 0, "The value of cellReferencesCount should be 0."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R27 site.CaptureRequirement( "MS-FSSHTTPD", 27, @"[In Common Node Object Properties][Intermediate of Cell References Count field] A compact unsigned 64-bit integer that MUST be zero."); #endregion }
/// <summary> /// Capture requirements related to GetVersions sub response. /// </summary> /// <param name="getVersionsSubResponse">Containing the getVersionsSubResponse information.</param> /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param> public static void ValidateGetVersionsSubResponse(GetVersionsSubResponseType getVersionsSubResponse, ITestSite site) { ValidateSubResponseType(getVersionsSubResponse as SubResponseType, site); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4694 // if can launch this method, the schema matches site.CaptureRequirementIfAreEqual<Type>( typeof(GetVersionsSubResponseType), getVersionsSubResponse.GetType(), "MS-FSSHTTP", 4695, @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: GetVersionsSubResponseType."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1816 // if can launch this method, the GetVersionsSubResponseType schema matches. site.CaptureRequirement( "MS-FSSHTTP", 1816, @"[In GetVersionsSubResponseType][The schema of GetVersionsSubResponseType is] <xs:complexType name=""GetVersionsSubResponseType""> <xs:complexContent> <xs:extension base=""tns:SubResponseType""> <xs:sequence minOccurs=""0"" maxOccurs=""1""> <xs:element ref=""tns:GetVersionsResponse""/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2020 // if can launch this method, the GetVersionsSubResponseType schema matches. site.CaptureRequirementIfAreEqual<Type>( typeof(GetVersionsSubResponseType), getVersionsSubResponse.GetType(), "MS-FSSHTTP", 2020, @"[In GetVersions Subrequest][The protocol client sends a GetVersions SubRequest message, which is of type GetVersionsSubRequestType] The protocol server responds with a GetVersions SubResponse message, which is of type GetVersionsSubResponseType as specified in section 2.3.1.32."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2026 // if can launch this method, the GetVersionsSubResponseType schema matches. site.CaptureRequirement( "MS-FSSHTTP", 2026, @"[In GetVersions Subrequest] The Results element, as specified in [MS-VERSS] section 2.2.4.1, is a complex type that specifies information about the file's versions."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2301 // If isSchemaValid is true, the GetVersionsSubResponseType schema matches. site.CaptureRequirement( "MS-FSSHTTP", 2301, @"[In GetVersionsSubResponseType][In Results] The DeleteAllVersions, DeleteVersion, GetVersions, and RestoreVersion methods return the Results complex type. <s:complexType name=""Results""> <s:sequence> <s:element name=""list"" maxOccurs=""1"" minOccurs=""1""> <s:complexType> <s:attribute name=""id"" type=""s:string"" use=""required"" /> </s:complexType> </s:element> <s:element name=""versioning"" maxOccurs=""1"" minOccurs=""1""> <s:complexType> <s:attribute name=""enabled"" type=""s:unsignedByte"" use=""required"" /> </s:complexType> </s:element> <s:element name=""settings"" maxOccurs=""1"" minOccurs=""1""> <s:complexType> <s:attribute name=""url"" type=""s:string"" use=""required"" /> </s:complexType> </s:element> <s:element name=""result"" maxOccurs=""unbounded"" minOccurs=""1"" type=""tns:VersionData""/> </s:sequence> </s:complexType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2303 // Add the log information. site.Log.Add(LogEntryKind.Debug, "For requirement MS-FSSHTTP_R2303, the versioning.enabled MUST be '0' or '1', the versioning.enabled value is : {0}", getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled.ToString()); // if can launch this method and the versioning.enabled schema matches and value must be 0 or 1. bool isVerifyR2303 = getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled == 0 || getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled == 1; site.CaptureRequirementIfIsTrue( isVerifyR2303, "MS-FSSHTTP", 2303, @"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: The value of this attribute [versioning.enabled] MUST be ""0"" or ""1""."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2308 // if can launch this method, the versioning.enabled schema matches. site.CaptureRequirement( "MS-FSSHTTP", 2308, @"[In GetVersionsSubResponseType][In VersionData] The VersionData complex type specifies the details about a single version of a file. <s:complexType name=""VersionData""> <s:attribute name=""version"" type=""s:string"" use=""required"" /> <s:attribute name=""url"" type=""s:string"" use=""required"" /> <s:attribute name=""created"" type=""s:string"" use=""required"" /> <s:attribute name=""createdRaw"" type=""s:string"" use=""required"" /> <s:attribute name=""createdBy"" type=""s:string"" use=""required"" /> <s:attribute name=""createdByName"" type=""s:string"" use=""optional"" /> <s:attribute name=""size"" type=""s:unsignedLong"" use=""required"" /> <s:attribute name=""comments"" type=""s:string"" use=""required"" /> </s:complexType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3083 // if can launch this method, the versioning.enabled schema matches. site.CaptureRequirement( "MS-FSSHTTP", 3083, @"[In GetVersionsResponse][The schema of GetVersionsResponse element is defined as:] <s:element name=""GetVersionsResponse""> <s:complexType> <s:sequence> <s:element minOccurs=""1"" maxOccurs=""1"" name=""GetVersionsResult""> <s:complexType> <s:sequence> <s:element name=""results"" minOccurs=""1"" maxOccurs=""1"" type=""tns:Results"" /> </s:sequence> </s:complexType> </s:element> </s:sequence> </s:complexType> </s:element>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3084 // if can launch this method, the versioning.enabled schema matches. site.CaptureRequirement( "MS-FSSHTTP", 3084, @"[In GetVersionsResponse] GetVersionsResult: An XML node that conforms to the structure specified in section 2.2.4.1. "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2306 // if can launch this method, the versioning.enabled schema matches. site.CaptureRequirement( "MS-FSSHTTP", 2306, @"[In GetVersionsSubResponseType][Results complex type] settings.url: Specifies the URL to the webpage of versioning-related settings for the document library in which the file resides. "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R60101 // if can launch this method, the versioning.enabled schema matches. site.CaptureRequirement( "MS-FSSHTTP", 60101, @"[In GetVersionsSubResponseType][VersionData] Implementation does contain the version of the file, including the major version and minor version numbers connected by period, for example, ""1.0"". (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)"); }
/// <summary> /// This method is used to verify the requirements related with the object count for the root node or intermediate node. /// </summary> /// <param name="data">Specify the object data.</param> /// <param name="site">Specify the ITestSite instance.</param> public static void VerifyObjectCount(ObjectGroupObjectData data, ITestSite site) { RootNodeObject rootNode = null; int index = 0; if (data.ObjectExGUIDArray.Count.DecodedValue > 1) { bool isRootNode = StreamObject.TryGetCurrent<RootNodeObject>(data.Data.Content.ToArray(), ref index, out rootNode); site.Log.Add( TestTools.LogEntryKind.Debug, "If there are more than one objects in the file, the server will respond the Root Node object for SharePoint Server 2013"); site.CaptureRequirementIfIsTrue( isRootNode, "MS-FSSHTTPD", 8202, @"[In Appendix A: Product Behavior] If there are more than one objects in the file,the implementation does return the Root Node Object. (Microsoft SharePoint Workspace 2010, Microsoft Office 2010 suites/Microsoft SharePoint Server 2010 and above follow this behavior.)"); } else { if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 8204, SharedContext.Current.Site)) { bool isRootNode = StreamObject.TryGetCurrent<RootNodeObject>(data.Data.Content.ToArray(), ref index, out rootNode); site.Log.Add( TestTools.LogEntryKind.Debug, "If there is an only object in the file, the server will respond the Root Node object for SharePoint Server 2013"); site.CaptureRequirementIfIsTrue( isRootNode, "MS-FSSHTTPD", 8204, @"[In Appendix A: Product Behavior] If there is only one object in the file,the implementation does return the Root Node Object. (Microsoft Office 2013/Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013/Microsoft SharePoint Workspace 2010 follow this behavior.)"); } } }
/// <summary> /// This method is used to test Response Error related adapter requirements. /// </summary> /// <param name="instance">Specify the instance which need to be verified.</param> /// <param name="site">Specify the ITestSite instance.</param> public void VerifyResponseError(ResponseError instance, ITestSite site) { // If the instance is not null and there are no parsing errors, then the Response Error related adapter requirements can be directly captured. if (null == instance) { site.Assert.Fail("The instance of type ResponseError is null due to parsing error or type casting error."); } // Verify the stream object header related requirements. this.ExpectStreamObjectHeaderStart(instance.StreamObjectHeaderStart, instance.GetType(), site); // Directly capture requirement MS-FSSHTTPB_R617, if the stream object header is StreamObjectHeaderStart32bit. site.CaptureRequirementIfAreEqual<Type>( typeof(StreamObjectHeaderStart32bit), instance.StreamObjectHeaderStart.GetType(), "MS-FSSHTTPB", 617, @"[In Response Error] Error Start (4 bytes): A 32-bit stream object header (section 2.2.1.5.2) that specifies an error start."); // Directly capture requirement MS-FSSHTTPB_R618, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 618, @"[In Response Error] Error Type GUID (16 bytes): A GUID that specifies the error type."); bool responseErrorFlag = instance.ErrorTypeGUID == new Guid(ResponseError.CellErrorGuid) || instance.ErrorTypeGUID == new Guid(ResponseError.ProtocolErrorGuid) || instance.ErrorTypeGUID == new Guid(ResponseError.Win32ErrorGuid) || instance.ErrorTypeGUID == new Guid(ResponseError.HresultErrorGuid); site.Assert.IsTrue( responseErrorFlag, "Actual the error type guid {0}, which should be either 5A66A756-87CE-4290-A38B-C61C5BA05A67,7AFEAEBF-033D-4828-9C31-3977AFE58249, 32C39011-6E39-46C4-AB78-DB41929D679E or 8454C8F2-E401-405A-A198-A10B6991B56E for requirement MS-FSSHTTPB_R619", instance.ErrorTypeGUID.ToString()); // Directly capture requirement MS-FSSHTTPB_R619, if the responseErrorFlag is true; site.CaptureRequirementIfIsTrue( responseErrorFlag, "MS-FSSHTTPB", 619, @"[In Response Error] Error Type GUID (16 bytes): The following table contains the possible values for the error type: [the value of the Error Type GUID field must be {5A66A756-87CE-4290-A38B-C61C5BA05A67},{7AFEAEBF-033D-4828-9C31-3977AFE58249}, {32C39011-6E39-46C4-AB78-DB41929D679E}, {8454C8F2-E401-405A-A198-A10B6991B56E}."); switch (instance.ErrorTypeGUID.ToString("D").ToUpper(CultureInfo.CurrentCulture)) { case ResponseError.CellErrorGuid: // Capture requirement MS-FSSHTTPB_R620, if the error data type is CellError. site.CaptureRequirementIfAreEqual<Type>( typeof(CellError), instance.ErrorData.GetType(), "MS-FSSHTTPB", 620, @"[In Response Error] Error Type GUID field is set to {5A66A756-87CE-4290-A38B-C61C5BA05A67}[ specifies the error type is ]Cell error (section 2.2.3.2.1)."); break; case ResponseError.ProtocolErrorGuid: // All the serial number null values related requirements can be located here. site.Log.Add(LogEntryKind.Debug, "Runs for ProtocolErrorGuid verification logic with the error code {0}.", instance.ErrorData.ErrorDetail); break; case ResponseError.Win32ErrorGuid: // Capture requirement MS-FSSHTTPB_R622, if the error data type is Win32 error. site.CaptureRequirementIfAreEqual<Type>( typeof(Win32Error), instance.ErrorData.GetType(), "MS-FSSHTTPB", 622, @"[In Response Error] Error Type GUID field is set to {32C39011-6E39-46C4-AB78-DB41929D679E}[ specifies the error type is ]Win32 error (section 2.2.3.2.3)."); break; case ResponseError.HresultErrorGuid: // Capture requirement MS-FSSHTTPB_R623, if the error data type is HRESULTError. site.CaptureRequirementIfAreEqual<Type>( typeof(HRESULTError), instance.ErrorData.GetType(), "MS-FSSHTTPB", 623, @"[In Response Error] Error Type GUID field is set to {8454C8F2-E401-405A-A198-A10B6991B56E}[ specifies the error type is ]HRESULT error (section 2.2.3.2.4)."); break; default: site.Assert.Fail("Unsupported error type GUID " + instance.ErrorTypeGUID.ToString()); break; } // Directly capture requirement MS-FSSHTTPB_R625, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 625, @"[In Response Error] Error Data (variable): A structure that specifies the error data based on the Error Type GUID."); if (instance.ChainedError != null) { // Directly capture requirement MS-FSSHTTPB_R631, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 631, @"[In Response Error] Chained Error (variable): An optional response error that specifies the chained error information."); } // Verify the stream object header end related requirements. this.ExpectStreamObjectHeaderEnd(instance.StreamObjectHeaderEnd, instance.GetType(), site); this.ExpectCompoundObject(instance.StreamObjectHeaderStart, site); // Directly capture requirement MS-FSSHTTPB_R632, if the stream object end is StreamObjectHeaderEnd16bit. site.CaptureRequirementIfAreEqual<Type>( typeof(StreamObjectHeaderEnd16bit), instance.StreamObjectHeaderEnd.GetType(), "MS-FSSHTTPB", 632, @"[In Response Error] Error End (2 bytes): A 16-bit stream object header (section 2.2.1.5.4) that specifies an error end."); }
/// <summary> /// This method is used to test Specialized Knowledge related adapter requirements. /// </summary> /// <param name="instance">Specify the instance which need to be verified.</param> /// <param name="site">Specify the ITestSite instance.</param> public void VerifySpecializedKnowledge(SpecializedKnowledge instance, ITestSite site) { // If the instance is not null and there are no parsing errors, then the Specialized Knowledge related adapter requirements can be directly captured. if (null == instance) { site.Assert.Fail("The instance of type SpecializedKnowledge is null due to parsing error or type casting error."); } // Verify the stream object header related requirements. this.ExpectStreamObjectHeaderStart(instance.StreamObjectHeaderStart, instance.GetType(), site); // Capture requirement MS-FSSHTTPB_R362, if stream object start type is StreamObjectHeaderStart32bit. site.CaptureRequirementIfAreEqual<Type>( typeof(StreamObjectHeaderStart32bit), instance.StreamObjectHeaderStart.GetType(), "MS-FSSHTTPB", 362, @"[In Specialized Knowledge] Specialized Knowledge Start (4 bytes): A 32-bit stream object header (section 2.2.1.5.2) that specifies A specialized knowledge start."); // Directly capture requirement MS-FSSHTTPB_R363, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 363, @"[In Specialized Knowledge] GUID (16 bytes): A GUID that specifies the type of specialized knowledge."); bool isVerifyR364 = instance.GUID == SpecializedKnowledge.CellKnowledgeGuid || instance.GUID == SpecializedKnowledge.ContentTagKnowledgeGuid || instance.GUID == SpecializedKnowledge.WaterlineKnowledgeGuid || instance.GUID == SpecializedKnowledge.FragmentKnowledgeGuid; site.Log.Add( LogEntryKind.Debug, "Actual GUID value {0}, expect the value either 327A35F6-0761-4414-9686-51E900667A4D, 3A76E90E-8032-4D0C-B9DD-F3C65029433E, 0ABE4F35-01DF-4134-A24A-7C79F0859844 or 10091F13-C882-40FB-9886-6533F934C21D for MS-FSSHTTPB_R364.", instance.GUID.ToString()); // Capture requirement MS-FSSHTTPB_R364, if the GUID equals the mentioned four values {327A35F6-0761-4414-9686-51E900667A4D}, {3A76E90E-8032-4D0C-B9DD-F3C65029433E}, {0ABE4F35-01DF-4134-A24A-7C79F0859844}, {10091F13-C882-40FB-9886-6533F934C21D}. site.CaptureRequirementIfIsTrue( isVerifyR364, "MS-FSSHTTPB", 364, @"[In Specialized Knowledge] The following GUIDs detail the type of knowledge contained: [Its value must be one of] {327A35F6-0761-4414-9686-51E900667A4D}, {3A76E90E-8032-4D0C-B9DD-F3C65029433E}, {0ABE4F35-01DF-4134-A24A-7C79F0859844}, {10091F13-C882-40FB-9886-6533F934C21D}]."); switch (instance.GUID.ToString("D").ToUpper(CultureInfo.CurrentCulture)) { case "327A35F6-0761-4414-9686-51E900667A4D": // Capture requirement MS-FSSHTTPB_R365, if the knowledge data type is CellKnowledge. site.CaptureRequirementIfAreEqual<Type>( typeof(CellKnowledge), instance.SpecializedKnowledgeData.GetType(), "MS-FSSHTTPB", 365, @"[In Specialized Knowledge][If the GUID field is set to ] {327A35F6-0761-4414-9686-51E900667A4D}, [it indicates the type of the specialized knowledge is]Cell knowledge (section 2.2.1.13.2)."); break; case "3A76E90E-8032-4D0C-B9DD-F3C65029433E": // Capture requirement MS-FSSHTTPB_R366, if the knowledge data type is WaterlineKnowledge. site.CaptureRequirementIfAreEqual<Type>( typeof(WaterlineKnowledge), instance.SpecializedKnowledgeData.GetType(), "MS-FSSHTTPB", 366, @"[In Specialized Knowledge][If the GUID field is set to ] {3A76E90E-8032-4D0C-B9DD-F3C65029433E}, [it indicates the type of the specialized knowledge is]Waterline knowledge (section 2.2.1.13.4)."); break; case "0ABE4F35-01DF-4134-A24A-7C79F0859844": // Capture requirement MS-FSSHTTPB_R367, if the knowledge data type is FragmentKnowledge. site.CaptureRequirementIfAreEqual<Type>( typeof(FragmentKnowledge), instance.SpecializedKnowledgeData.GetType(), "MS-FSSHTTPB", 367, @"[In Specialized Knowledge][If the GUID field is set to ] {0ABE4F35-01DF-4134-A24A-7C79F0859844}, [it indicates the type of the specialized knowledge is]Fragment knowledge (section 2.2.1.13.3)."); break; case "10091F13-C882-40FB-9886-6533F934C21D": // Capture requirement MS-FSSHTTPB_R368, if the knowledge data type is ContentTagKnowledge. site.CaptureRequirementIfAreEqual<Type>( typeof(ContentTagKnowledge), instance.SpecializedKnowledgeData.GetType(), "MS-FSSHTTPB", 368, @"[In Specialized Knowledge][If the GUID field is set to ] {10091F13-C882-40FB-9886-6533F934C21D}, [it indicates the type of the specialized knowledge is]Content tag knowledge (section 2.2.1.13.5)."); break; default: site.Assert.Fail("Unsupported specialized knowledge value " + instance.GUID.ToString()); break; } // Directly capture requirement MS-FSSHTTPB_R369, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 369, @"[In Specialized Knowledge] Specialized Knowledge Data (variable): The data for the specific knowledge type."); // Verify the stream object header end related requirements. this.ExpectStreamObjectHeaderEnd(instance.StreamObjectHeaderEnd, instance.GetType(), site); this.ExpectCompoundObject(instance.StreamObjectHeaderStart, site); // Capture requirement MS-FSSHTTPB_R370, if the stream object end type is StreamObjectHeaderEnd16bit. site.CaptureRequirementIfAreEqual<Type>( typeof(StreamObjectHeaderEnd16bit), instance.StreamObjectHeaderEnd.GetType(), "MS-FSSHTTPB", 370, @"[In Specialized Knowledge] Specialized Knowledge End (2 bytes): A 16-bit stream object header (section 2.2.1.5.4) that specifies specialized knowledge end."); }
/// <summary> /// Capture requirements related to GetVersions sub response. /// </summary> /// <param name="getVersionsSubResponse">Containing the getVersionsSubResponse information.</param> /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param> public static void ValidateGetVersionsSubResponse(GetVersionsSubResponseType getVersionsSubResponse, ITestSite site) { ValidateSubResponseType(getVersionsSubResponse as SubResponseType, site); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4694 // if can launch this method, the schema matches site.CaptureRequirementIfAreEqual <Type>( typeof(GetVersionsSubResponseType), getVersionsSubResponse.GetType(), "MS-FSSHTTP", 4695, @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: GetVersionsSubResponseType."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1816 // if can launch this method, the GetVersionsSubResponseType schema matches. site.CaptureRequirement( "MS-FSSHTTP", 1816, @"[In GetVersionsSubResponseType][The schema of GetVersionsSubResponseType is] <xs:complexType name=""GetVersionsSubResponseType""> <xs:complexContent> <xs:extension base=""tns:SubResponseType""> <xs:sequence minOccurs=""0"" maxOccurs=""1""> <xs:element ref=""tns:GetVersionsResponse""/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2020 // if can launch this method, the GetVersionsSubResponseType schema matches. site.CaptureRequirementIfAreEqual <Type>( typeof(GetVersionsSubResponseType), getVersionsSubResponse.GetType(), "MS-FSSHTTP", 2020, @"[In GetVersions Subrequest][The protocol client sends a GetVersions SubRequest message, which is of type GetVersionsSubRequestType] The protocol server responds with a GetVersions SubResponse message, which is of type GetVersionsSubResponseType as specified in section 2.3.1.32."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2026 // if can launch this method, the GetVersionsSubResponseType schema matches. site.CaptureRequirement( "MS-FSSHTTP", 2026, @"[In GetVersions Subrequest] The Results element, as specified in [MS-VERSS] section 2.2.4.1, is a complex type that specifies information about the file's versions."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2301 // If isSchemaValid is true, the GetVersionsSubResponseType schema matches. site.CaptureRequirement( "MS-FSSHTTP", 2301, @"[In GetVersionsSubResponseType][In Results] The DeleteAllVersions, DeleteVersion, GetVersions, and RestoreVersion methods return the Results complex type. <s:complexType name=""Results""> <s:sequence> <s:element name=""list"" maxOccurs=""1"" minOccurs=""1""> <s:complexType> <s:attribute name=""id"" type=""s:string"" use=""required"" /> </s:complexType> </s:element> <s:element name=""versioning"" maxOccurs=""1"" minOccurs=""1""> <s:complexType> <s:attribute name=""enabled"" type=""s:unsignedByte"" use=""required"" /> </s:complexType> </s:element> <s:element name=""settings"" maxOccurs=""1"" minOccurs=""1""> <s:complexType> <s:attribute name=""url"" type=""s:string"" use=""required"" /> </s:complexType> </s:element> <s:element name=""result"" maxOccurs=""unbounded"" minOccurs=""1"" type=""tns:VersionData""/> </s:sequence> </s:complexType>"); if (getVersionsSubResponse.GetVersionsResponse != null) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2303 // Add the log information. site.Log.Add(LogEntryKind.Debug, "For requirement MS-FSSHTTP_R2303, the versioning.enabled MUST be '0' or '1', the versioning.enabled value is : {0}", getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled.ToString()); // if can launch this method and the versioning.enabled schema matches and value must be 0 or 1. bool isVerifyR2303 = getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled == 0 || getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled == 1; site.CaptureRequirementIfIsTrue( isVerifyR2303, "MS-FSSHTTP", 2303, @"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: The value of this attribute [versioning.enabled] MUST be ""0"" or ""1""."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2308 // if can launch this method, the versioning.enabled schema matches. site.CaptureRequirement( "MS-FSSHTTP", 2308, @"[In GetVersionsSubResponseType][In VersionData] The VersionData complex type specifies the details about a single version of a file. <s:complexType name=""VersionData""> <s:attribute name=""version"" type=""s:string"" use=""required"" /> <s:attribute name=""url"" type=""s:string"" use=""required"" /> <s:attribute name=""created"" type=""s:string"" use=""required"" /> <s:attribute name=""createdRaw"" type=""s:string"" use=""required"" /> <s:attribute name=""createdBy"" type=""s:string"" use=""required"" /> <s:attribute name=""createdByName"" type=""s:string"" use=""optional"" /> <s:attribute name=""size"" type=""s:unsignedLong"" use=""required"" /> <s:attribute name=""comments"" type=""s:string"" use=""required"" /> </s:complexType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3083 // if can launch this method, the versioning.enabled schema matches. site.CaptureRequirement( "MS-FSSHTTP", 3083, @"[In GetVersionsResponse][The schema of GetVersionsResponse element is defined as:] <s:element name=""GetVersionsResponse""> <s:complexType> <s:sequence> <s:element minOccurs=""1"" maxOccurs=""1"" name=""GetVersionsResult""> <s:complexType> <s:sequence> <s:element name=""results"" minOccurs=""1"" maxOccurs=""1"" type=""tns:Results"" /> </s:sequence> </s:complexType> </s:element> </s:sequence> </s:complexType> </s:element>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3084 // if can launch this method, the versioning.enabled schema matches. site.CaptureRequirement( "MS-FSSHTTP", 3084, @"[In GetVersionsResponse] GetVersionsResult: An XML node that conforms to the structure specified in section 2.2.4.1. "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2306 // if can launch this method, the versioning.enabled schema matches. site.CaptureRequirement( "MS-FSSHTTP", 2306, @"[In GetVersionsSubResponseType][Results complex type] settings.url: Specifies the URL to the webpage of versioning-related settings for the document library in which the file resides. "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R60101 // if can launch this method, the versioning.enabled schema matches. site.CaptureRequirement( "MS-FSSHTTP", 60101, @"[In GetVersionsSubResponseType][VersionData] Implementation does contain the version of the file, including the major version and minor version numbers connected by period, for example, ""1.0"". (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)"); } }
/// <summary> /// Capture requirements related to coauthoring sub response. /// </summary> /// <param name="coauthSubResponse">The coauthoring response.</param> /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param> public static void ValidateCoauthSubResponse(CoauthSubResponseType coauthSubResponse, ITestSite site) { ValidateSubResponseType(coauthSubResponse as SubResponseType, site); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4687 // if can launch this method, the schema matches. site.CaptureRequirementIfAreEqual<Type>( typeof(CoauthSubResponseType), coauthSubResponse.GetType(), "MS-FSSHTTP", 4687, @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: CoauthSubResponseType."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R5742 // if can launch this method, the schema matches. site.CaptureRequirementIfAreEqual<Type>( typeof(CoauthSubResponseType), coauthSubResponse.GetType(), "MS-FSSHTTP", 5742, @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: CoauthSubResponseType."); if (string.Compare("Success", coauthSubResponse.ErrorCode, StringComparison.OrdinalIgnoreCase) == 0) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1496 bool isVerifyR1496 = coauthSubResponse.SubResponseData != null; // If the coauthSubResponse.SubResponseData is null, the case run fail. site.Assert.IsTrue( isVerifyR1496, "For requirement MS-FSSHTTP_R1496, the SubResponseData should not be NULL."); // if coauthSubResponse.SubResponseData is not null, make sure sent as part of the SubResponse element in a cell storage service response message, // so this requirement can be captured. site.CaptureRequirement( "MS-FSSHTTP", 1496, @"[In CoauthSubResponseType] As part of processing the coauthoring subrequest, the SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the following condition is true: The ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success""."); // Add the log information. site.Log.Add(LogEntryKind.Debug, "Verify MS-FSSHTTP_R267:the returned SubResponseData is {0}", coauthSubResponse.SubResponseData.ToString()); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R267 // if coauthSubResponse.SubResponseData is not null, make sure sent as part of the SubResponse element in a cell storage service response message, // so this requirement can be captured. bool isVerifyR267 = coauthSubResponse.SubResponseData != null; site.CaptureRequirementIfIsTrue( isVerifyR267, "MS-FSSHTTP", 267, @"[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 ""Coauth""."); } // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R624 // If the coauthoring subResponse exists,its schema will have been validated before invoking the method CaptureJoinCoauthoringSessionRelatedRequirements. // So MS-FSSHTTP_R624 can be captured. site.CaptureRequirement( "MS-FSSHTTP", 624, @"[In CoauthSubResponseType][CoauthSubResponseType schema is:] <xs:complexType name=""CoauthSubResponseType""> <xs:complexContent> <xs:extension base=""tns:SubResponseType""> <xs:sequence minOccurs=""0"" maxOccurs=""1""> <xs:element name=""SubResponseData"" type=""tns:CoauthSubResponseDataType"" /> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R984 // Since the subResponse is of type CoauthSubResponseType, so this requirement can be captured. site.CaptureRequirementIfAreEqual<Type>( typeof(CoauthSubResponseType), coauthSubResponse.GetType(), "MS-FSSHTTP", 984, @"[In Coauth Subrequest][The protocol client sends a coauthoring SubRequest message, which is of type CoauthSubRequestType,] The protocol server responds with a coauthoring SubResponse message, which is of type CoauthSubResponseType as specified in section 2.3.1.8."); if (coauthSubResponse.SubResponseData != null) { ValidateCoauthSubResponseDataType(coauthSubResponse.SubResponseData, site); } }
/// <summary> /// Capture requirements related with Response element. /// </summary> /// <param name="response">The Response information</param> /// <param name="site">Instance of ITestSite</param> private static void ValidateResponseElement(Response response, ITestSite site) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R97 site.CaptureRequirement( "MS-FSSHTTP", 97, @"[In Response][Response element schema is:] <xs:element name=""Response""> <!--Allows for the numbers to be displayed between the SubResponse elements--> <xs:complexType mixed=""true""> <xs:sequence minOccurs=""1"" maxOccurs=""unbounded""> <xs:element name=""SubResponse"" type=""tns:SubResponseElementGenericType"" /> </xs:sequence> <xs:attribute name=""Url"" type=""xs:string"" use=""required""/> <xs:attribute name=""RequestToken"" type=""xs:nonNegativeInteger"" use=""required"" /> <xs:attribute name=""HealthScore"" type=""xs:integer"" use=""required""/> <xs:attribute name=""ErrorCode"" type=""tns:GenericErrorCodeTypes"" use=""optional"" /> <xs:attribute name=""ErrorMessage"" type=""xs:string"" use=""optional""/> </xs:complexType> </xs:element>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R104 site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R104, the Url attribute value should be specified, the actual Url value is: {0}", response.Url != null ? response.Url : "NULL"); site.CaptureRequirementIfIsNotNull( response.Url, "MS-FSSHTTP", 104, @"[In Response] The Url attribute MUST be specified for each Response element."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1482 // The responseElement.SubResponse.Length specifies the number of SubResponse element in Response. bool isVerifiedR96 = response.SubResponse.Length >= 1; site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R1482, the Response element should contain one or more SubResponse elements, the actual SubResponse elements number is: {0}", response.SubResponse.Length.ToString()); site.CaptureRequirementIfIsTrue( isVerifiedR96, "MS-FSSHTTP", 96, @"[In Response] Each Response element MUST contain one or more SubResponse elements."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R107 site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R263, the RequestToken should be specified, the actual RequestToken value is: {0}", response.RequestToken != null ? response.RequestToken : "NULL"); site.CaptureRequirementIfIsNotNull( response.RequestToken, "MS-FSSHTTP", 107, @"[In Response] The RequestToken MUST be specified for each Response element."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2076 bool isVerifyR2076 = int.Parse(response.HealthScore) <= 10 && int.Parse(response.HealthScore) >= 0; site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R2076, the HealthScore value should be between 0 and 10, the actual HealthScore value is: {0}", response.HealthScore); site.CaptureRequirementIfIsTrue( isVerifyR2076, "MS-FSSHTTP", 2076, @"[In Response] HealthScore: An integer which value is between 0 and 10."); // Verify requirements related with SubResponse element if (response.SubResponse != null) { foreach (SubResponseElementGenericType subResponse in response.SubResponse) { ValidateSubResponseElement(subResponse, site); } } // Verify requirements related with GenericErrorCodeTypes if (response.ErrorCodeSpecified) { ValidateGenericErrorCodeTypes(site); } }
/// <summary> /// Verify ObjectGroupObjectData for the DataNodeObject related requirements. /// </summary> /// <param name="objectGroupObjectData">Specify the objectGroupObjectData instance.</param> /// <param name="dataNodeDeclare">Specify the data node object declare instance.</param> /// <param name="objectGroupList">Specify all the ObjectGroupDataElementData list.</param> /// <param name="site">Specify the ITestSite instance.</param> public static void VerifyObjectGroupObjectDataForDataNodeObject(ObjectGroupObjectData objectGroupObjectData, ObjectGroupObjectDeclare dataNodeDeclare, List<ObjectGroupDataElementData> objectGroupList, ITestSite site) { #region Verify the Object Group Object Data // Object Extended GUID Array : Specifies an ordered list of the Object Extended GUIDs for each child of the Root Node. ExGUIDArray childObjectExGuidArray = objectGroupObjectData.ObjectExGUIDArray; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The count of Cell ID Array is:{0}", childObjectExGuidArray.Count.DecodedValue); // If the Object Extended GUID Array is an empty list, indicates that the count of the array is 0. // So capture these requirements. // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R3 site.CaptureRequirementIfAreEqual<ulong>( 0, childObjectExGuidArray.Count.DecodedValue, "MS-FSSHTTPD", 3, @"[In Common Node Object Properties][Data of Object Extended GUID Array field] Specifies an empty list of Object Extended GUIDs."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R71 site.CaptureRequirementIfAreEqual<ulong>( 0, childObjectExGuidArray.Count.DecodedValue, "MS-FSSHTTPD", 71, @"[In Data Node Object References] The Object Extended GUID Array, as specified in [MS-FSSHTTPB] section 2.2.1.12.6.4, of the Data Node Object MUST specify an empty array."); // Cell ID Array : Specifies an empty list of Cell IDs. CellIDArray cellIDArray = objectGroupObjectData.CellIDArray; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The count of Cell ID Array is:{0}", cellIDArray.Count); // If the Object Extended GUID Array is an empty list, indicates that the count of the array is 0. // So capture these requirements. // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R6 site.CaptureRequirementIfAreEqual<ulong>( 0, cellIDArray.Count, "MS-FSSHTTPD", 6, @"[In Common Node Object Properties][Data of Cell ID Array field] Specifies an empty list of Cell IDs."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R72 site.CaptureRequirementIfAreEqual<ulong>( 0, cellIDArray.Count, "MS-FSSHTTPD", 72, @"[In Data Node Object Cell References] The Object Extended GUID Array, as specified in [MS-FSSHTTPB] section 2.2.1.12.6.4, of the Data Node Object MUST specify an empty array."); #endregion #region Verify the Object Group Object Declaration // Object Extended GUID : An extended GUID which specifies an identifier for this object. This GUID MUST be unique within this file. ExGuid currentObjectExGuid = dataNodeDeclare.ObjectExtendedGUID; // Check whether Object Extended GUID is unique. bool isUnique = IsGuidUnique(currentObjectExGuid, objectGroupList); // Add the log information. site.Log.Add(LogEntryKind.Debug, "Whether the Object Extended GUID is unique:{0}", isUnique); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8103 site.CaptureRequirementIfIsTrue( isUnique, "MS-FSSHTTPD", 8103, @"[In Common Node Object Properties][Data of Object Extended GUID field] This GUID[Object Extended GUID] MUST be different within this file in once response."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R8103 site.CaptureRequirementIfIsTrue( isUnique, "MS-FSSHTTPD", 8103, @"[In Common Node Object Properties][Data of Object Extended GUID field] This GUID[Object Extended GUID] MUST be different within this file in once response."); // Object Partition ID : A compact unsigned 64-bit integer which MUST be 1. Compact64bitInt objectPartitionID = dataNodeDeclare.ObjectPartitionID; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The value of Object Partition ID is:{0}", objectPartitionID.DecodedValue); site.Assert.IsTrue(typeof(Compact64bitInt).Equals(objectPartitionID.GetType()), "The type of objectPartitionID should be a compact unsigned 64-bit integer."); site.Assert.IsTrue(objectPartitionID.DecodedValue == 1, "The actual value of objectPartitionID should be 1."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R19 site.CaptureRequirement( "MS-FSSHTTPD", 19, @"[In Common Node Object Properties][Data of Object Partition ID field] A compact unsigned 64-bit integer that MUST be ""1""."); // Object Data Size : A compact unsigned 64-bit integer which MUST be the size of the Object Data field. Compact64bitInt objectDataSize = dataNodeDeclare.ObjectDataSize; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The value of Object Data Size is:{0}", objectDataSize.DecodedValue); // Get the size of Object Data. ulong sizeInObjectData = (ulong)objectGroupObjectData.Data.Length.DecodedValue; site.Assert.IsTrue(typeof(Compact64bitInt).Equals(objectDataSize.GetType()), "The type of objectPartitionID should be a compact unsigned 64-bit integer."); site.Assert.IsTrue(objectDataSize.DecodedValue == sizeInObjectData, "The actual value of objectDataSize should be same as the Object Data field"); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R22 site.CaptureRequirement( "MS-FSSHTTPD", 22, @"[In Common Node Object Properties][Data of Object Data Size field] A compact unsigned 64-bit integer that MUST be the size of the Object Data field."); // Object References Count : A compact unsigned 64-bit integer that specifies the number of object references. Compact64bitInt objectReferencesCount = dataNodeDeclare.ObjectReferencesCount; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The count of Object References is:{0}", objectReferencesCount.DecodedValue); site.Assert.IsTrue(typeof(Compact64bitInt).Equals(objectReferencesCount.GetType()), "The type of objectReferencesCount should be a compact unsigned 64-bit integer."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R25 site.CaptureRequirement( "MS-FSSHTTPD", 25, @"[In Common Node Object Properties][Data of Object References Count field] A compact unsigned 64-bit integer that specifies the number of object references."); // Cell References Count : A compact unsigned 64-bit integer which MUST be 0. Compact64bitInt cellReferencesCount = dataNodeDeclare.CellReferencesCount; // Add the log information. site.Log.Add(LogEntryKind.Debug, "The value of Cell References is:{0}", cellReferencesCount.DecodedValue); site.Assert.IsTrue(typeof(Compact64bitInt).Equals(cellReferencesCount.GetType()), "The type of cellReferencesCount should be a compact unsigned 64-bit integer."); site.Assert.IsTrue(cellReferencesCount.DecodedValue == 0, "The value of cellReferencesCount should be 0."); // Verify MS-FSSHTTPD requirement: MS-FSSHTTPD_R28 site.CaptureRequirement( "MS-FSSHTTPD", 28, @"[In Common Node Object Properties][Data of Cell References Count field] A compact unsigned 64-bit integer that MUST be zero."); #endregion }
/// <summary> /// Capture requirements related with MinorVersionNumberType. /// </summary> /// <param name="minorVersionNumber">The minor version number</param> /// <param name="site">Instance of ITestSite</param> private static void ValidateMinorVersionNumberType(ushort minorVersionNumber, ITestSite site) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R409 site.CaptureRequirement( "MS-FSSHTTP", 409, @"[In MinorVersionNumberType][MinorVersionNumberType schema is:] <xs:simpleType name=""MinorVersionNumberType""> <xs:restriction base=""xs:unsignedShort""> <xs:minInclusive value=""0""/> <xs:maxInclusive value=""2""/> </xs:restriction> </xs:simpleType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R410 bool isVerifiedR410 = minorVersionNumber == 0 || minorVersionNumber == 2; site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R410, the MinorVersionNumberType value should be 0 or 2, the actual MinorVersionNumberType value is: {0}", minorVersionNumber.ToString()); site.CaptureRequirementIfIsTrue( isVerifiedR410, "MS-FSSHTTP", 410, @"[In MinorVersionNumberType] The value of MinorVersionNumberType MUST be 0 or 2."); }
/// <summary> /// Capture requirements related with Response message /// </summary> /// <param name="storageResponse">The storage response information</param> /// <param name="requestToken">The expected RequestToken</param> /// <param name="site">Instance of ITestSite</param> public static void ValidateResponse(CellStorageResponse storageResponse, string requestToken, ITestSite site) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R17 site.CaptureRequirement( "MS-FSSHTTP", 17, @"[In Response] The protocol response schema is specified by the following: <?xml version=""1.0"" encoding=""utf-8""?> <xs:schema xmlns:tns=""http://schemas.microsoft.com/sharepoint/soap/"" attributeFormDefault=""unqualified"" elementFormDefault=""qualified"" targetNamespace=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xs=""http://www.w3.org/2001/XMLSchema"" xmlns:i=""http://www.w3.org/2004/08/xop/include""> <xs:import namespace=""http://www.w3.org/2004/08/xop/include"" /> <xs:element name=""Envelope""> <xs:complexType> <xs:sequence> <xs:element name=""Body""> <xs:complexType> <xs:sequence> <xs:element ref=""tns:ResponseVersion"" minOccurs=""1"" maxOccurs=""1"" /> <xs:element ref=""tns:ResponseCollection"" minOccurs=""0"" maxOccurs=""1""/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R18 site.CaptureRequirement( "MS-FSSHTTP", 18, @"[In Response] The Body element of each SOAP response message MUST contain a ResponseVersion element."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R19 site.CaptureRequirement( "MS-FSSHTTP", 19, @"[In Response] [The Body element of each SOAP response message MUST contain] zero or more ResponseCollection elements."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1613 bool isVerifiedR1613 = storageResponse.ResponseVersion != null; site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R1613, [In Messages] Response: The detail element of the protocol response contains a ResponseVersion element, the actual ResponseVersion elements is: {0}", storageResponse.ResponseVersion != null ? storageResponse.ResponseVersion.ToString() : "NULL"); site.CaptureRequirementIfIsTrue( isVerifiedR1613, "MS-FSSHTTP", 1613, @"[In Messages] Response: The detail element of the protocol response contains a ResponseVersion element and zero or one ResponseCollection elements."); // Verify requirements related with ResponseVersion ValidateResponseVersion(storageResponse.ResponseVersion, site); // Verify requirements related with ResponseCollection if (storageResponse.ResponseCollection != null) { ValidateResponseCollection(storageResponse.ResponseCollection, requestToken, site); } }
/// <summary> /// Verify both role requirements about HTTP header. /// </summary> /// <param name="httpHeader">Indicates the pair of key and value of the HTTP request or response header.</param> public static void VerifyPccrtpCommonHeader(Dictionary <string, string> httpHeader) { #region MS-PCCRTP_R6 bool isVerifyR6 = httpHeader.ContainsKey("X-P2P-PeerDist") && !string.IsNullOrEmpty(httpHeader["X-P2P-PeerDist"]); // Add the debug information site.Log.Add( LogEntryKind.Debug, @"Verify MS-PCCRTP_R6. The header field {0} contain X-P2P-PeerDist field.", isVerifyR6 ? string.Empty : "does not "); // Verify MS-PCCRTP requirement: MS-PCCRTP_R6 site.CaptureRequirementIfIsTrue( isVerifyR6, 6, @"[Message Syntax]The syntax of this header[extension-header] field value is described as follows [extension-header = X-P2P-PeerDist X-P2P-PeerDist = ""X-P2P-PeerDist"" "":"" peerdist-params]."); #endregion #region MS-PCCRTP_R13 string[] headerValues = httpHeader["X-P2P-PeerDist"].Split(new char[] { ',' }); string versionString = headerValues[0].Substring(headerValues[0].IndexOf('=') + 1); // Add the debug information site.Log.Add( LogEntryKind.Debug, "Verify MS-PCCRTP_R13. Actual value of version is: {0}.", versionString); bool isVerifyR13 = versionString.Contains(".") && !versionString.Contains(" "); // Verify MS-PCCRTP requirement: MS-PCCRTP_R13 site.CaptureRequirementIfIsTrue( isVerifyR13, 13, @"[In Message Syntax] Note that there can be no spaces between major-version and ""."" as well as ""."" and minor-version [version = ""Version"" ""="" major-version ""."" minor-version]."); #endregion #region MS-PCCRTP_R14 string[] versionStrValues = headerValues[0].Split(new char[] { '.', '=' }); int majorValue; int minorValue; string marjorVersionStr = versionStrValues[1]; string minorVersionStr = versionStrValues[2]; bool isVerifyR14 = int.TryParse(marjorVersionStr, out majorValue) && int.TryParse(minorVersionStr, out minorValue); // Add the debug information site.Log.Add( LogEntryKind.Debug, "Verify MS-PCCRTP_R14. Actual value of version is: {0}.", headerValues[0]); // Verify MS-PCCRTP requirement: MS-PCCRTP_R14 site.CaptureRequirementIfIsTrue( isVerifyR14, 14, @"[In Message Syntax] The major and minor versions MUST be considered as separate multidigit numbers [major-version = 1*DIGIT minor-version = 1*DIGIT]."); #endregion }
/// <summary> /// Capture requirements related to coauthoring sub response. /// </summary> /// <param name="coauthSubResponse">The coauthoring response.</param> /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param> public static void ValidateCoauthSubResponse(CoauthSubResponseType coauthSubResponse, ITestSite site) { ValidateSubResponseType(coauthSubResponse as SubResponseType, site); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4687 // if can launch this method, the schema matches. site.CaptureRequirementIfAreEqual <Type>( typeof(CoauthSubResponseType), coauthSubResponse.GetType(), "MS-FSSHTTP", 4687, @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: CoauthSubResponseType."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R5742 // if can launch this method, the schema matches. site.CaptureRequirementIfAreEqual <Type>( typeof(CoauthSubResponseType), coauthSubResponse.GetType(), "MS-FSSHTTP", 5742, @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: CoauthSubResponseType."); if (string.Compare("Success", coauthSubResponse.ErrorCode, StringComparison.OrdinalIgnoreCase) == 0) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1496 bool isVerifyR1496 = coauthSubResponse.SubResponseData != null; // If the coauthSubResponse.SubResponseData is null, the case run fail. site.Assert.IsTrue( isVerifyR1496, "For requirement MS-FSSHTTP_R1496, the SubResponseData should not be NULL."); // if coauthSubResponse.SubResponseData is not null, make sure sent as part of the SubResponse element in a cell storage service response message, // so this requirement can be captured. site.CaptureRequirement( "MS-FSSHTTP", 1496, @"[In CoauthSubResponseType] As part of processing the coauthoring subrequest, the SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the following condition is true: The ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success""."); // Add the log information. site.Log.Add(LogEntryKind.Debug, "Verify MS-FSSHTTP_R267:the returned SubResponseData is {0}", coauthSubResponse.SubResponseData.ToString()); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R267 // if coauthSubResponse.SubResponseData is not null, make sure sent as part of the SubResponse element in a cell storage service response message, // so this requirement can be captured. bool isVerifyR267 = coauthSubResponse.SubResponseData != null; site.CaptureRequirementIfIsTrue( isVerifyR267, "MS-FSSHTTP", 267, @"[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 ""Coauth""."); } // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R624 // If the coauthoring subResponse exists,its schema will have been validated before invoking the method CaptureJoinCoauthoringSessionRelatedRequirements. // So MS-FSSHTTP_R624 can be captured. site.CaptureRequirement( "MS-FSSHTTP", 624, @"[In CoauthSubResponseType][CoauthSubResponseType schema is:] <xs:complexType name=""CoauthSubResponseType""> <xs:complexContent> <xs:extension base=""tns:SubResponseType""> <xs:sequence minOccurs=""0"" maxOccurs=""1""> <xs:element name=""SubResponseData"" type=""tns:CoauthSubResponseDataType"" /> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R984 // Since the subResponse is of type CoauthSubResponseType, so this requirement can be captured. site.CaptureRequirementIfAreEqual <Type>( typeof(CoauthSubResponseType), coauthSubResponse.GetType(), "MS-FSSHTTP", 984, @"[In Coauth Subrequest][The protocol client sends a coauthoring SubRequest message, which is of type CoauthSubRequestType,] The protocol server responds with a coauthoring SubResponse message, which is of type CoauthSubResponseType as specified in section 2.3.1.8."); if (coauthSubResponse.SubResponseData != null) { ValidateCoauthSubResponseDataType(coauthSubResponse.SubResponseData, site); } }
/// <summary> /// Capture requirements related with UserEmailAddress. /// </summary> /// <param name="userEmailAddress">The UserEmailAddress</param> /// <param name="site">Instance of ITestSite</param> private static void ValidateUserEmailAddress(string userEmailAddress, ITestSite site) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R909 bool isVerifiedR909 = AdapterHelper.IsValidEmailAddr(userEmailAddress); site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R909, the format of the e-mail addresses should be as specified in [RFC2822] section 3.4.1, the actual e-mail addresses value is: {0}", userEmailAddress); site.CaptureRequirementIfIsTrue( isVerifiedR909, "MS-FSSHTTP", 909, @"[In WhoAmISubResponseDataOptionalAttributes][UserEmailAddress] The format of the email address MUST be as specified in [RFC2822] section 3.4.1."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1467 bool isVerifiedR1467 = AdapterHelper.IsValidEmailAddr(userEmailAddress); site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R1467, the value format of the userEmailAddress attribute should be as specified in [RFC2822], the actual userEmailAddress value is: {0}", userEmailAddress); site.CaptureRequirementIfIsTrue( isVerifiedR1467, "MS-FSSHTTP", 1467, @"[In WhoAmISubResponseDataOptionalAttributes][UserEmailAddress] Format of the e-mail addresses MUST be: addr-spec = local-part ""@"" domain local-part = dot-atom / quoted-string / obs-local-part domain = dot-atom / domain-literal / obs-domain domain-literal = [CFWS] ""["" *([FWS] dcontent) [FWS] ""]"" [CFWS] dcontent = dtext / quoted-pair dtext = NO-WS-CTL / ; Non white space controls %d33-90 / ; The rest of the US-ASCII %d94-126 ; characters not including ""["", ; ""]"", or ""\"" quoted-pair = (""\"" text) / obs-qp text = %d1-9 / ; Characters excluding CR and LF %d11 / %d12 / %d14-127 / obs-text obs-text = *LF *CR *(obs-char *LF *CR) obs-char = %d0-9 / %d11 / ; %d0-127 except CR and %d12 / %d14-127 ; LF obs-domain = atom *(""."" atom) atom = [CFWS] 1*atext [CFWS] atext = ALPHA / DIGIT / ; Any character except controls, ""!"" / ""#"" / ; SP, and specials. ""$"" / ""%"" / ; Used for atoms ""&"" / ""'"" / ""*"" / ""+"" / ""-"" / ""/"" / ""="" / ""?"" / ""^"" / ""_"" / ""`"" / ""{"" / ""|"" / ""}"" / ""~"" dot-atom = [CFWS] dot-atom-text [CFWS] dot-atom-text = 1*atext *(""."" 1*atext) NO-WS-CTL = %d1-8 / ; US-ASCII control characters %d11 / ; that do not include the %d12 / ; carriage return, line feed, %d14-31 / ; and white space characters %d127"); }
/// <summary> /// This method is used to test Specialized Knowledge related adapter requirements. /// </summary> /// <param name="instance">Specify the instance which need to be verified.</param> /// <param name="site">Specify the ITestSite instance.</param> public void VerifySpecializedKnowledge(SpecializedKnowledge instance, ITestSite site) { // If the instance is not null and there are no parsing errors, then the Specialized Knowledge related adapter requirements can be directly captured. if (null == instance) { site.Assert.Fail("The instance of type SpecializedKnowledge is null due to parsing error or type casting error."); } // Verify the stream object header related requirements. this.ExpectStreamObjectHeaderStart(instance.StreamObjectHeaderStart, instance.GetType(), site); // Capture requirement MS-FSSHTTPB_R362, if stream object start type is StreamObjectHeaderStart32bit. site.CaptureRequirementIfAreEqual <Type>( typeof(StreamObjectHeaderStart32bit), instance.StreamObjectHeaderStart.GetType(), "MS-FSSHTTPB", 362, @"[In Specialized Knowledge] Specialized Knowledge Start (4 bytes): A 32-bit stream object header (section 2.2.1.5.2) that specifies A specialized knowledge start."); // Directly capture requirement MS-FSSHTTPB_R363, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 363, @"[In Specialized Knowledge] GUID (16 bytes): A GUID that specifies the type of specialized knowledge."); bool isVerifyR364 = instance.GUID == SpecializedKnowledge.CellKnowledgeGuid || instance.GUID == SpecializedKnowledge.ContentTagKnowledgeGuid || instance.GUID == SpecializedKnowledge.WaterlineKnowledgeGuid || instance.GUID == SpecializedKnowledge.FragmentKnowledgeGuid; site.Log.Add( LogEntryKind.Debug, "Actual GUID value {0}, expect the value either 327A35F6-0761-4414-9686-51E900667A4D, 3A76E90E-8032-4D0C-B9DD-F3C65029433E, 0ABE4F35-01DF-4134-A24A-7C79F0859844 or 10091F13-C882-40FB-9886-6533F934C21D for MS-FSSHTTPB_R364.", instance.GUID.ToString()); // Capture requirement MS-FSSHTTPB_R364, if the GUID equals the mentioned four values {327A35F6-0761-4414-9686-51E900667A4D}, {3A76E90E-8032-4D0C-B9DD-F3C65029433E}, {0ABE4F35-01DF-4134-A24A-7C79F0859844}, {10091F13-C882-40FB-9886-6533F934C21D}. site.CaptureRequirementIfIsTrue( isVerifyR364, "MS-FSSHTTPB", 364, @"[In Specialized Knowledge] The following GUIDs detail the type of knowledge contained: [Its value must be one of] {327A35F6-0761-4414-9686-51E900667A4D}, {3A76E90E-8032-4D0C-B9DD-F3C65029433E}, {0ABE4F35-01DF-4134-A24A-7C79F0859844}, {10091F13-C882-40FB-9886-6533F934C21D}]."); switch (instance.GUID.ToString("D").ToUpper(CultureInfo.CurrentCulture)) { case "327A35F6-0761-4414-9686-51E900667A4D": // Capture requirement MS-FSSHTTPB_R365, if the knowledge data type is CellKnowledge. site.CaptureRequirementIfAreEqual <Type>( typeof(CellKnowledge), instance.SpecializedKnowledgeData.GetType(), "MS-FSSHTTPB", 365, @"[In Specialized Knowledge][If the GUID field is set to ] {327A35F6-0761-4414-9686-51E900667A4D}, [it indicates the type of the specialized knowledge is]Cell knowledge (section 2.2.1.13.2)."); break; case "3A76E90E-8032-4D0C-B9DD-F3C65029433E": // Capture requirement MS-FSSHTTPB_R366, if the knowledge data type is WaterlineKnowledge. site.CaptureRequirementIfAreEqual <Type>( typeof(WaterlineKnowledge), instance.SpecializedKnowledgeData.GetType(), "MS-FSSHTTPB", 366, @"[In Specialized Knowledge][If the GUID field is set to ] {3A76E90E-8032-4D0C-B9DD-F3C65029433E}, [it indicates the type of the specialized knowledge is]Waterline knowledge (section 2.2.1.13.4)."); break; case "0ABE4F35-01DF-4134-A24A-7C79F0859844": // Capture requirement MS-FSSHTTPB_R367, if the knowledge data type is FragmentKnowledge. site.CaptureRequirementIfAreEqual <Type>( typeof(FragmentKnowledge), instance.SpecializedKnowledgeData.GetType(), "MS-FSSHTTPB", 367, @"[In Specialized Knowledge][If the GUID field is set to ] {0ABE4F35-01DF-4134-A24A-7C79F0859844}, [it indicates the type of the specialized knowledge is]Fragment knowledge (section 2.2.1.13.3)."); break; case "10091F13-C882-40FB-9886-6533F934C21D": // Capture requirement MS-FSSHTTPB_R368, if the knowledge data type is ContentTagKnowledge. site.CaptureRequirementIfAreEqual <Type>( typeof(ContentTagKnowledge), instance.SpecializedKnowledgeData.GetType(), "MS-FSSHTTPB", 368, @"[In Specialized Knowledge][If the GUID field is set to ] {10091F13-C882-40FB-9886-6533F934C21D}, [it indicates the type of the specialized knowledge is]Content tag knowledge (section 2.2.1.13.5)."); break; default: site.Assert.Fail("Unsupported specialized knowledge value " + instance.GUID.ToString()); break; } // Directly capture requirement MS-FSSHTTPB_R369, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 369, @"[In Specialized Knowledge] Specialized Knowledge Data (variable): The data for the specific knowledge type."); // Verify the stream object header end related requirements. this.ExpectStreamObjectHeaderEnd(instance.StreamObjectHeaderEnd, instance.GetType(), site); this.ExpectCompoundObject(instance.StreamObjectHeaderStart, site); // Capture requirement MS-FSSHTTPB_R370, if the stream object end type is StreamObjectHeaderEnd16bit. site.CaptureRequirementIfAreEqual <Type>( typeof(StreamObjectHeaderEnd16bit), instance.StreamObjectHeaderEnd.GetType(), "MS-FSSHTTPB", 370, @"[In Specialized Knowledge] Specialized Knowledge End (2 bytes): A 16-bit stream object header (section 2.2.1.5.4) that specifies specialized knowledge end."); }
/// <summary> /// This method is used to analyze the chunk. /// </summary> /// <param name="rootNode">Specify the root node object which will be analyzed.</param> /// <param name="site">Specify the ITestSite instance.</param> public override void AnalyzeChunking(IntermediateNodeObject rootNode, ITestSite site) { List <LeafNodeObject> cloneList = new List <LeafNodeObject>(rootNode.IntermediateNodeObjectList); while (cloneList.Count != 0) { LeafNodeObject nodeObject = cloneList.First(); byte[] content = nodeObject.DataNodeObjectData.ObjectData; if (cloneList.Count == 1) { if (content.Length > 1048576) { throw new NotImplementedException("If the final chunk is larger than 1MB, the signature method is not implemented."); } // Only final chunk left SignatureObject expect = this.GetSHA1Signature(content); if (!expect.Equals(nodeObject.Signature)) { site.Assert.Fail("For the Zip file, final part chunk expect the signature {0}, actual signature {1}", expect.ToString(), nodeObject.Signature.ToString()); } // Verify the less than 1MB final part related requirements if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { MsfsshttpdCapture.VerifySmallFinalChunk(SharedContext.Current.Site); } } else { if (ZipHeader.IsFileHeader(content, 0)) { byte[] dataFileSignatureBytes; byte[] header = this.AnalyzeFileHeader(content, 0, out dataFileSignatureBytes); int headerLength = header.Length; int compressedSize = (int)this.GetCompressedSize(dataFileSignatureBytes); if (headerLength + compressedSize <= 4096) { if (Common.GetConfigurationPropertyValue("SutVersion", SharedContext.Current.Site) != "SharePointFoundation2010" && Common.GetConfigurationPropertyValue("SutVersion", SharedContext.Current.Site) != "SharePointServer2010") { LeafNodeObject expectNode = new LeafNodeObject.IntermediateNodeObjectBuilder().Build(content, this.GetSingleChunkSignature(header, dataFileSignatureBytes)); if (!expectNode.Signature.Equals(nodeObject.Signature)) { site.Assert.Fail("For the Zip file, when zip file is less than 4096, expect the signature {0}, actual signature {1}", expectNode.Signature.ToString(), nodeObject.Signature.ToString()); } } // Verify the zip file less than 4096 bytes MsfsshttpdCapture.VerifyZipFileLessThan4096Bytes(SharedContext.Current.Site); } else { SignatureObject expectHeader = this.GetSHA1Signature(header); if (!expectHeader.Equals(nodeObject.Signature)) { site.Assert.Fail("For the Zip file header, expect the signature {0}, actual signature {1}", expectHeader.ToString(), nodeObject.Signature.ToString()); } // Remove the header node cloneList.RemoveAt(0); // Then expect the next is file content node nodeObject = cloneList.First(); // Here having something need to be distinguished between the MOSS2010 and MOSS2013 if (nodeObject.DataNodeObjectData == null && nodeObject.IntermediateNodeObjectList != null) { if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 8213, SharedContext.Current.Site)) { bool isR8213Verified = false; if (compressedSize > 1024 * 1024 && nodeObject.IntermediateNodeObjectList.Count > 1) { isR8213Verified = true; } site.CaptureRequirementIfIsTrue( isR8213Verified, "MS-FSSHTTPD", 8213, @"[In Appendix A: Product Behavior] For implementation, if the number of .ZIP file bytes represented by a chunk is greater than 1 megabyte, a list of subchunks is generated. <4> Section 2.4.1: For SharePoint Server 2010, if the number of .ZIP file bytes represented by a chunk is greater than 1 megabyte, a list of subchunks is generated."); } if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 8207, SharedContext.Current.Site)) { bool isR8207Verified = false; if (compressedSize > 3 * 1024 * 1024 && nodeObject.IntermediateNodeObjectList.Count > 1) { isR8207Verified = true; } site.CaptureRequirementIfIsTrue( isR8207Verified, "MS-FSSHTTPD", 8207, @"[In Appendix A: Product Behavior] For implementation, if the number of .ZIP file bytes represented by a chunk is greater than 3 megabytes, a list of subchunks is generated. (Microsoft Office 2013/Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013/Microsoft SharePoint Workspace 2010/Microsft Office 2016/Microsft SharePoint Server 2016 follow this behavior.)"); } if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 8208, SharedContext.Current.Site) && Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 8210, SharedContext.Current.Site)) { bool isR8208Verified = true; bool isR8210Verified = true; if (nodeObject.IntermediateNodeObjectList[nodeObject.IntermediateNodeObjectList.Count - 1].DataSize.DataSize > 1024 * 1024) { isR8208Verified = false; } for (int i = 0; i < nodeObject.IntermediateNodeObjectList.Count - 1; i++) { if (nodeObject.IntermediateNodeObjectList[i].DataSize.DataSize != 1024 * 1024) { isR8210Verified = false; } } site.CaptureRequirementIfIsTrue( isR8208Verified, "MS-FSSHTTPD", 8208, @"[In Appendix A: Product Behavior] The size of each subchunk is at most 1 megabyte. (Microsoft SharePoint Server 2010 follows this behavior.)"); site.CaptureRequirementIfIsTrue( isR8210Verified, "MS-FSSHTTPD", 8210, @"[In Appendix A: Product Behavior] All but the last subchunk MUST be 1 megabyte in size. (Microsfot SharePoint Server 2010 follows this behavior.)"); } if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 8209, SharedContext.Current.Site) && Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 8211, SharedContext.Current.Site)) { bool isR8209Verified = true; bool isR8211Verified = true; if (nodeObject.IntermediateNodeObjectList[nodeObject.IntermediateNodeObjectList.Count - 1].DataSize.DataSize > 3 * 1024 * 1024) { isR8209Verified = false; } for (int i = 0; i < nodeObject.IntermediateNodeObjectList.Count - 1; i++) { if (nodeObject.IntermediateNodeObjectList[i].DataSize.DataSize != 3 * 1024 * 1024) { isR8211Verified = false; } } site.CaptureRequirementIfIsTrue( isR8209Verified, "MS-FSSHTTPD", 8209, @"[In Appendix A: Product Behavior] The size of each subchunk is at most 3 megabytes. (Microsoft Office 2013/Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013/Microsoft SharePoint Workspace 2010/Microsft Office 2016/Microsft SharePoint Server 2016 follow this behavior.)"); site.CaptureRequirementIfIsTrue( isR8211Verified, "MS-FSSHTTPD", 8211, @"[In Appendix A: Product Behavior] All but the last subchunk MUST be 3 megabyte in size. (Microsoft Office 2013/Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013/Microsoft SharePoint Workspace 2010/Microsft Office 2016/Microsft SharePoint Server 2016 follow this behavior.)"); } } else if (nodeObject.DataNodeObjectData != null) { site.Assert.AreEqual <ulong>( (ulong)compressedSize, nodeObject.DataSize.DataSize, "The Data Size of the Intermediate Node Object MUST be the total number of bytes represented by the chunk."); if (Common.GetConfigurationPropertyValue("SutVersion", SharedContext.Current.Site) != "SharePointFoundation2010" && Common.GetConfigurationPropertyValue("SutVersion", SharedContext.Current.Site) != "SharePointServer2010") { SignatureObject contentSignature = new SignatureObject(); contentSignature.SignatureData = new BinaryItem(dataFileSignatureBytes); if (!contentSignature.Equals(nodeObject.Signature)) { site.Assert.Fail("For the Zip file content, expect the signature {0}, actual signature {1}", contentSignature.ToString(), nodeObject.Signature.ToString()); } } // Verify the zip file larger than 4096 bytes and less than 1MB. if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { MsfsshttpdCapture.VerifyZipFileHeaderAndContentSignature(SharedContext.Current.Site); MsfsshttpdCapture.VerifyIntermediateNodeForZipFileChunk(SharedContext.Current.Site); } } else { throw new InvalidOperationException("The DataNodeObjectData and IntermediateNodeObjectList cannot be null at the same time."); } } } } cloneList.RemoveAt(0); } }
/// <summary> /// Capture requirements related with VersioningUserTableType. /// </summary> /// <param name="userTable">The VersioningUserTableType</param> /// <param name="site">Instance of ITestSite</param> private static void ValidateVersioningUserTableType(VersioningUserTableType userTable, ITestSite site) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11158 site.CaptureRequirement( "MS-FSSHTTP", 11158, @"[In VersioningUserTableType] <xs:complexType name=""VersioningUserTableType""> <s:element name=""UserTable"" minOccurs=""1"" maxOccurs=""1""> <s:complexType> <s:element name=""User"" maxOccurs=""unbounded"" minOccurs=""1"" type=""tns:UserDataType"" /> </s:complexType> </s:element> </xs:complexType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11159 site.CaptureRequirement( "MS-FSSHTTP", 11159, @"[In VersioningUserTableType] User: An element of type UserDataType (section 2.3.1.42) which describes a single user."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11164 site.CaptureRequirement( "MS-FSSHTTP", 11164, @"[In UserDataType] <xs:complexType name=""UserDataType""> < s:attribute name = ""UserId"" type = ""xs:integer"" use = ""required"" /> < s:attribute name = ""UserLogin"" type = ""xs:UserLoginType"" use = ""required"" /> < s:attribute name = ""UserName"" type = ""xs:UserNameType"" use = ""optional"" /> < s:attribute name = ""UserEmailAddress"" type = ""s:string"" use = ""optional"" /> </ xs:complexType > "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11165 site.CaptureRequirement( "MS-FSSHTTP", 11165, @"[In UserDataType] UserId: An integer that uniquely specifies the user in this user table."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11167 site.CaptureRequirement( "MS-FSSHTTP", 11167, @"[In UserDataType] UserLogin: A UserLoginType that specifies the user login alias of the protocol client."); if (!string.IsNullOrEmpty(userTable.User[0].UserName)) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11169 site.CaptureRequirement( "MS-FSSHTTP", 11169, @"[In UserDataType] UserName: A UserNameType that specifies the user name for the protocol client."); } if (!string.IsNullOrEmpty(userTable.User[0].UserEmailAddress)) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11171 site.CaptureRequirement( "MS-FSSHTTP", 11171, @"[In UserDataType] UserEmailAddress: A string that specifies the email address associated with the protocol client."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11172 site.CaptureRequirementIfIsTrue( AdapterHelper.IsValidEmailAddr(userTable.User[0].UserEmailAddress), "MS-FSSHTTP", 11172, @"[In UserDataType] The format of the email address MUST be as specified in [RFC2822] section 3.4.1."); } }
/// <summary> /// This method is used to test Allocate ExtendedGuid Range related adapter requirements. /// </summary> /// <param name="instance">Specify the instance which need to be verified.</param> /// <param name="site">Specify the ITestSite instance.</param> public void VerifyAllocateExtendedGuidRangeSubResponseData(AllocateExtendedGuidRangeSubResponseData instance, ITestSite site) { // If the instance is not null and there are no parsing errors, then the Allocate ExtendedGuid Range related adapter requirements can be directly captured. if (null == instance) { site.Assert.Fail("The instance of type AllocateExtendedGuidRangeSubResponseData is null due to parsing error or type casting error."); } // Verify the stream object header related requirements. this.ExpectStreamObjectHeaderStart(instance.AllocateExtendedGUIDRangeResponse, instance.GetType(), site); // Directly capture requirement MS-FSSHTTPB_R2203, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 2203, @"[In Allocate ExtendedGuid Range] Allocate ExtendedGuid Range Response (4 bytes): A stream object header (section 2.2.1.5) that specifies an allocate extendedGUID range response."); // Directly capture requirement MS-FSSHTTPB_R2204, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 2204, @"[In Allocate ExtendedGuid Range] GUID Component (16 bytes): A GUID that specifies the GUID portion of the reserved extended GUIDs (section 2.2.1.7)."); // Directly capture requirement MS-FSSHTTPB_R2205, if there are no parsing errors. // This requirement is partially captured, only the type "A compact unsigned 64-bit integer" can be captured. site.CaptureRequirement( "MS-FSSHTTPB", 2205, @"[In Allocate ExtendedGuid Range] Integer Range Min (variable): A compact unsigned 64-bit integer (section 2.2.1.1) that specifies the first integer element in the range of extended GUIDs."); // Directly capture requirement MS-FSSHTTPB_R2206, if there are no parsing errors. // This requirement is partially captured, only the type "A compact unsigned 64-bit integer" can be captured. site.CaptureRequirement( "MS-FSSHTTPB", 2206, @"[In Allocate ExtendedGuid Range] [Integer Range Max (variable)] specifies the last + 1 integer element in the range of extended GUIDs."); bool isVerifiedR99062 = instance.IntegerRangeMax.DecodedValue >= 1000 && instance.IntegerRangeMax.DecodedValue <= 100000; site.Log.Add( LogEntryKind.Debug, "The Integer Range Max should be in the range 1000 and 100000, its actual value is {0}", instance.IntegerRangeMax.DecodedValue); site.CaptureRequirementIfIsTrue( isVerifiedR99062, "MS-FSSHTTPB", 99062, @"[In Allocate ExtendedGuid Range] Integer Range Max (variable): A compact unsigned 64-bit integer with a minimum allowed value of 1000 and maximum allowed value of 100000."); // Verify the compound related requirements. this.ExpectSingleObject(instance.AllocateExtendedGUIDRangeResponse, site); }
/// <summary> /// Capture requirements related with VersioningVersionListType. /// </summary> /// <param name="versionList">The VersioningVersionListType</param> /// <param name="site">Instance of ITestSite</param> private static void ValidateVersioningVersionListType(VersioningVersionListType versionList, ITestSite site) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11161 site.CaptureRequirement( "MS-FSSHTTP", 11161, @"[In VersioningVersionListType] <xs:complexType name=""VersioningVersionListType""> <s:element name=""Versions"" minOccurs=""1"" maxOccurs=""1""> <s:complexType> <s:element name=""Version"" maxOccurs=""unbounded"" minOccurs=""1"" type=""tns:FileVersionDataType"" /> </s:complexType> </s:element> </xs:complexType>"); if (versionList.Version != null) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11162 site.CaptureRequirement( "MS-FSSHTTP", 11162, @"[In VersioningVersionListType] Version: An element of type FileVersionDataType (section 2.3.1.43) which describes a single version of the file on the server."); } if (!string.IsNullOrEmpty(versionList.Version[0].Number)) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11176 site.CaptureRequirement( "MS-FSSHTTP", 11176, @"[In FileVersionDataType] Number: A FileVersionNumberType (section 2.2.5.15) that specifies the unique version number of the version of the file."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11078 site.CaptureRequirement( "MS-FSSHTTP", 11078, @"[In FileVersionNumberType] [The schema of FileVersionNumberType is:] <xs:simpleType name=""FileVersionNumberType""> <xs:restriction base=""xs:string""> <xs:pattern value=""[0-9]+[.][0-9]+"" /> </xs:restriction> </xs:simpleType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11079 site.CaptureRequirement( "MS-FSSHTTP", 11079, @"[In FileVersionNumberType] The value of a FileVersionNumberType is typically in the form major.minor (for example, 1.0)."); } if (!string.IsNullOrEmpty(versionList.Version[0].LastModifiedTime)) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11177 site.CaptureRequirement( "MS-FSSHTTP", 11177, @"[In FileVersionDataType] LastModifiedTime: A positive integer that specifies the last modified time of the version of the file, which is expressed as a tick count."); } if (versionList.Version[0].Events != null && versionList.Version[0].Events != null) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11182 site.CaptureRequirement( "MS-FSSHTTP", 11182, @"[In FileVersionDataType] Event: A FileVersionEventDataType that represents an event that happened to the version of the file."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11184 site.CaptureRequirement( "MS-FSSHTTP", 11184, @"[In FileVersionEventDataType] <xs:complexType name=""FileVersionEventDataType""> < s:attribute name = ""Id"" type = ""xs:integer"" use = ""required"" /> < s:attribute name = ""Type"" type = ""xs:integer"" use = ""required"" /> < s:attribute name = ""CreateTime"" type = ""xs:positiveInteger"" use = ""optional"" /> < s:attribute name = ""UserId"" type = ""xs:integer"" use = ""optional"" /> </ xs:complexType > "); System.Collections.Generic.List <string> ids = new System.Collections.Generic.List <string>(); bool isR11185Verified = true; foreach (FileVersionDataType version in versionList.Version) { if (version.Events != null) { foreach (FileVersionEventDataType eventData in version.Events) { if (!ids.Contains(eventData.Id)) { ids.Add(eventData.Id); } else { isR11185Verified = false; break; } } } } // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11185 site.CaptureRequirementIfIsTrue( isR11185Verified, "MS-FSSHTTP", 11185, @"[In FileVersionEventDataType] Id: An integer that uniquely identifies an event among all events to all versions of the file."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11186 site.CaptureRequirement( "MS-FSSHTTP", 11186, @"[In FileVersionEventDataType] Type: An integer that identifies the type of event that occurred to the file."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11191 site.CaptureRequirement( "MS-FSSHTTP", 11191, @"[In FileVersionEventDataType] CreateTime: A positive integer that specifies the time when this event occurred, which is expressed as a tick count."); foreach (FileVersionDataType version in versionList.Version) { if (version.Events != null) { foreach (FileVersionEventDataType eventData in version.Events) { bool isR11187Verified = versionList.Version[0].Events[0].Type.Equals("1", StringComparison.CurrentCultureIgnoreCase) || versionList.Version[0].Events[0].Type.Equals("2", StringComparison.CurrentCultureIgnoreCase) || versionList.Version[0].Events[0].Type.Equals("3", StringComparison.CurrentCultureIgnoreCase); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11187 site.CaptureRequirementIfIsTrue( isR11187Verified, "MS-FSSHTTP", 11187, @"[In FileVersionEventDataType] The value MUST be one of the values [1, 2, 3] in the following table."); } } } } }
/// <summary> /// Capture BLOCK_RANGE structure releated requirements. /// </summary> /// <param name="blockRange">BLOCK_RANGE object</param> public static void CaptureBlockRangeRequirements(BLOCK_RANGE blockRange) { // // Add the debug information // site.Log.Add(LogEntryKind.Debug, "Verify MS-PCCRR_R26"); // Verify MS-PCCRR requirement: MS-PCCRR_R26 site.CaptureRequirementIfAreEqual <int>( 4, Marshal.SizeOf(blockRange.Index), 26, @"[In BLOCK_RANGE]Index (4 bytes): The index of the first block in the range."); // // Add the debug information // site.Log.Add(LogEntryKind.Debug, "Verify MS-PCCRR_R27"); // Verify MS-PCCRR requirement: MS-PCCRR_R27 // Eccept the 4 bytes, this sentence is internal behavior, so this requirements can noly be // verified a small part. site.CaptureRequirementIfAreEqual <int>( 4, Marshal.SizeOf(blockRange.Count), 27, @"[In BLOCK_RANGE]Count (4 bytes): Count of consecutive adjacent blocks in that range, including the block at the Index location."); // // Add the debug information // site.Log.Add(LogEntryKind.Debug, "Verify MS-PCCRR_R28"); // Verify MS-PCCRR requirement: MS-PCCRR_R28 bool isVerifyR28 = blockRange.Count > 0; site.CaptureRequirementIfIsTrue( isVerifyR28, 28, @"[In BLOCK_RANGE][Count (4 bytes)]The value of this field MUST be greater than 0."); // If R26 and R27 is verified successfully, means this RS can be verified directly. site.CaptureRequirement( 25, @"[In BLOCK_RANGE]A BLOCK_RANGE is an array of two integers that defines a consecutive array of blocks."); // // Add the debug information // site.Log.Add(LogEntryKind.Debug, "Verify MS-PCCRR_R29"); // Verify MS-PCCRR requirement: MS-PCCRR_R29 bool isVerifyR29 = blockRange.Index >= 0x00000000 && blockRange.Index <= 0xFFFFFFFF; site.CaptureRequirementIfIsTrue( isVerifyR29, 29, @"[In BLOCK_RANGE]Index is integer fields in the range of 0x00000000 to 0xFFFFFFFF."); // // Add the debug information // site.Log.Add(LogEntryKind.Debug, "Verify MS-PCCRR_R2900"); // Verify MS-PCCRR requirement: MS-PCCRR_R2900 bool isVerifyR2900 = blockRange.Count >= 0x00000000 && blockRange.Count <= 0xFFFFFFFF; site.CaptureRequirementIfIsTrue( isVerifyR2900, 2900, @"[In BLOCK_RANGE]Count is integer fields in the range of 0x00000000 to 0xFFFFFFFF."); // // Add the debug information // site.Log.Add(LogEntryKind.Debug, "Verify MS-PCCRR_R30"); // Verify MS-PCCRR requirement: MS-PCCRR_R30 bool isVerifyR30 = blockRange.Index >= 0 && blockRange.Index <= 511; site.CaptureRequirementIfIsTrue( isVerifyR30, 30, @"[In BLOCK_RANGE][Index field]contain a value in the range from 0 to 511 (inclusive) for the Index field."); // // Add the debug information // site.Log.Add(LogEntryKind.Debug, "Verify MS-PCCRR_R31"); // Verify MS-PCCRR requirement: MS-PCCRR_R31 bool isVerifyR31 = blockRange.Count >= 1 && blockRange.Count <= 511; site.CaptureRequirementIfIsTrue( isVerifyR31, 31, @"[In BLOCK_RANGE][Count field contains a value in the range from]1 to 511–Index (inclusive) for the Count field."); }
/// <summary> /// This method is used to test Data Element Types related adapter requirements. /// </summary> /// <param name="instance">Specify the instance which need to be verified.</param> /// <param name="site">Specify the ITestSite instance.</param> public void VerifyDataElement(DataElement instance, ITestSite site) { // If the instance is not null and there are no parsing errors, then the Data Element related adapter requirements can be directly captured. if (null == instance) { site.Assert.Fail("The instance of type DataElement is null due to parsing error or type casting error."); } bool isVerifyR246 = (int)instance.DataElementType == 0x01 || (int)instance.DataElementType == 0x02 || (int)instance.DataElementType == 0x03 || (int)instance.DataElementType == 0x04 || (int)instance.DataElementType == 0x05 || (int)instance.DataElementType == 0x06 || (int)instance.DataElementType == 0x0A; site.Assert.IsTrue( isVerifyR246, "For the requirement MS-FSSHTTPB_R246, the data element type value is either 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 or 0x0A"); // Directly capture requirement MS-FSSHTTPB_R246, if there are no parsing errors. site.CaptureRequirementIfIsTrue( isVerifyR246, "MS-FSSHTTPB", 246, @"[In Data Element Types] The following table lists the possible data element types:[Its value must be one of 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x0A]."); switch ((int)instance.DataElementType) { case 0x01: site.Assert.AreEqual<Type>( typeof(StorageIndexDataElementData), instance.Data.GetType(), "When the DataElementType value is 0x1, expect the Data type is StorageIndexDataElementData."); // Capture requirement MS-FSSHTTPB_R247, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 247, @"[In Data Element Types][If the related Data Element is type of ] Storage Index (section 2.2.1.12.2), [the Data Element Type field is set to]0x01."); // Verify the storage index data element related requirements. this.VerifyStorageIndexDataElement(instance, site); break; case 0x2: site.Assert.AreEqual<Type>( typeof(StorageManifestDataElementData), instance.Data.GetType(), "When the DataElementType value is 0x2, expect the Data type is StorageManifestDataElementData."); // Capture requirement MS-FSSHTTPB_R248, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 248, @"[In Data Element Types][If the related Data Element is type of ] Storage Manifest (section 2.2.1.12.3), [the Data Element Type field is set to]0x02."); // Verify the storage manifest data element related requirements. this.VerifyStorageManifestDataElement(instance, site); break; case 0x03: site.Assert.AreEqual<Type>( typeof(CellManifestDataElementData), instance.Data.GetType(), "When the DataElementType value is 0x3, expect the Data type is CellManifestDataElementData."); // Directly capture requirement MS-FSSHTTPB_R249, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 249, @"[In Data Element Types][If the related Data Element is type of ] Cell Manifest (section 2.2.1.12.4), [the Data Element Type field is set to]0x03."); // Verify the cell manifest data element related requirements. this.VerifyCellManifestDataElement(instance, site); break; case 0x4: site.Assert.AreEqual<Type>( typeof(RevisionManifestDataElementData), instance.Data.GetType(), "When the DataElementType value is 0x4, expect the Data type is RevisionManifestDataElementData."); // Directly capture requirement MS-FSSHTTPB_R250, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 250, @"[In Data Element Types][If the related Data Element is type of ] Revision Manifest (section 2.2.1.12.5), [the Data Element Type field is set to]0x04."); // Verify the revision manifest data element related requirements. this.VerifyRevisionManifestDataElement(instance, site); break; case 0x05: site.Assert.AreEqual<Type>( typeof(ObjectGroupDataElementData), instance.Data.GetType(), "When the DataElementType value is 0x5, expect the Data type is ObjectGroupDataElementData."); // Directly capture requirement MS-FSSHTTPB_R251, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 251, @"[In Data Element Types][If the related Data Element is type of ] Object Group (section 2.2.1.12.6), [the Data Element Type field is set to]0x05."); // Verify the object group data element related requirements. this.VerifyObjectGroupDataElement(instance, site); break; case 0x6: site.Assert.AreEqual<Type>( typeof(FragmentDataElementData), instance.Data.GetType(), "When the DataElementType value is 0x6, expect the Data type is FragmentDataElementData."); // Directly capture requirement MS-FSSHTTPB_R252, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 252, @"[In Data Element Types][If the related Data Element is type of ] Data Element Fragment (section 2.2.1.12.7), [the Data Element Type field is set to]0x06."); // Verify the object group data element related requirements. this.VerifyFragmentDataElement(instance, site); break; case 0xA: site.Assert.AreEqual<Type>( typeof(ObjectDataBLOBDataElementData), instance.Data.GetType(), "When the DataElementType value is 0xA, expect the Data type is ObjectDataBLOBDataElementData."); // Directly capture requirement MS-FSSHTTPB_R253, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 253, @"[In Data Element Types][If the related Data Element is type of ] Object Data BLOB (section 2.2.1.12.8), [the Data Element Type field is set to]0x0A."); this.VerifyObjectDataBLOBDataElement(instance, site); break; default: site.Assert.Fail("Unsupported Data Element Type value " + (int)instance.DataElementType); break; } }