Object Metadata Declaration
Наследование: StreamObject
        /// <summary>
        /// Used to return the length of this element.
        /// </summary>
        /// <param name="byteArray">A Byte array</param>
        /// <param name="startIndex">Start position</param>
        /// <returns>The length of the element</returns>
        public override int DeserializeDataElementDataFromByteArray(byte[] byteArray, int startIndex)
        {
            int index = startIndex;

            DataElementHash dataElementHash;
            if (StreamObject.TryGetCurrent<DataElementHash>(byteArray, ref index, out dataElementHash))
            {
                this.DataElementHash = dataElementHash;
            }

            this.ObjectGroupDeclarations = StreamObject.GetCurrent<ObjectGroupDeclarations>(byteArray, ref index);

            ObjectGroupMetadataDeclarations objectMetadataDeclaration = new ObjectGroupMetadataDeclarations();
            if (StreamObject.TryGetCurrent<ObjectGroupMetadataDeclarations>(byteArray, ref index, out objectMetadataDeclaration))
            {
                this.ObjectMetadataDeclaration = objectMetadataDeclaration;
            }

            this.ObjectGroupData = StreamObject.GetCurrent<ObjectGroupData>(byteArray, ref index);

            return index - startIndex;
        }
        /// <summary>
        /// Used to return the length of this element.
        /// </summary>
        /// <param name="byteArray">A Byte array</param>
        /// <param name="startIndex">Start position</param>
        /// <returns>The length of the element</returns>
        public override int DeserializeDataElementDataFromByteArray(byte[] byteArray, int startIndex)
        {
            int index = startIndex;

            DataElementHash dataElementHash;

            if (StreamObject.TryGetCurrent <DataElementHash>(byteArray, ref index, out dataElementHash))
            {
                this.DataElementHash = dataElementHash;
            }

            this.ObjectGroupDeclarations = StreamObject.GetCurrent <ObjectGroupDeclarations>(byteArray, ref index);

            ObjectGroupMetadataDeclarations objectMetadataDeclaration = new ObjectGroupMetadataDeclarations();

            if (StreamObject.TryGetCurrent <ObjectGroupMetadataDeclarations>(byteArray, ref index, out objectMetadataDeclaration))
            {
                this.ObjectMetadataDeclaration = objectMetadataDeclaration;
            }

            this.ObjectGroupData = StreamObject.GetCurrent <ObjectGroupData>(byteArray, ref index);

            return(index - startIndex);
        }
        /// <summary>
        /// This method is used to test Object Metadata Declaration 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 VerifyObjectGroupMetadataDeclarations(ObjectGroupMetadataDeclarations instance, ITestSite site)
        {
            // If the instance is not null and there are no parsing errors, then the Object Metadata Declaration related adapter requirements can be directly captured.
            if (null == instance)
            {
                site.Assert.Fail("The instance of type ObjectGroupMetadataDeclarations 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_R2108, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     2108,
                     @"[In Object Metadata Declaration] Object Group Metadata Declarations (variable): 32-bit stream object header section 2.2.1.5.2) that specifies an object group metadata declarations.");

            // Directly capture requirement MS-FSSHTTPB_R2109, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     2109,
                     @"[In Object Metadata Declaration] Object Metadata (variable): An array of object metadata (section 2.2.1.12.6.3.1) that specifies the object metadata.");

            // 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_R2110, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     2110,
                     @"[In Object Metadata Declaration] Object Group Metadata Declarations End (2 byte): An 16-bit stream object header (section 2.2.1.5.4) that specifies the end of object group metadata declarations.");

            if (Common.Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 21072, site))
            {
                // Directly capture requirement MS-FSSHTTPB_R2110, if the code runs here.
                site.CaptureRequirement(
                    "MS-FSSHTTPB",
                    21072,
                    @"[In Appendix B: Product Behavior] Implementation does support an Object Metadata Declaration.(SharePoint Server 2013 follow this behavior.)");
            }
        }