/// <summary>
            /// This method is used to create ObjectGroupObjectDeclare instance from a data node object.
            /// </summary>
            /// <param name="node">Specify the node object.</param>
            /// <returns>Return the ObjectGroupObjectDeclare instance.</returns>
            private ObjectGroupObjectDeclare CreateObjectDeclare(DataNodeObjectData node)
            {
                ObjectGroupObjectDeclare objectGroupObjectDeclare = new ObjectGroupObjectDeclare();

                objectGroupObjectDeclare.ObjectExtendedGUID    = node.ExGuid;
                objectGroupObjectDeclare.ObjectPartitionID     = new Compact64bitInt(1u);
                objectGroupObjectDeclare.CellReferencesCount   = new Compact64bitInt(0u);
                objectGroupObjectDeclare.ObjectReferencesCount = new Compact64bitInt(1u);
                objectGroupObjectDeclare.ObjectDataSize        = new Compact64bitInt((ulong)node.ObjectData.LongLength);

                return(objectGroupObjectDeclare);
            }
            /// <summary>
            /// This method is used to create ObjectGroupObjectDeclare instance from a data node object.
            /// </summary>
            /// <param name="node">Specify the node object.</param>
            /// <returns>Return the ObjectGroupObjectDeclare instance.</returns>
            private ObjectGroupObjectDeclare CreateObjectDeclare(DataNodeObjectData node)
            {
                ObjectGroupObjectDeclare objectGroupObjectDeclare = new ObjectGroupObjectDeclare();

                objectGroupObjectDeclare.ObjectExtendedGUID = node.ExGuid;
                objectGroupObjectDeclare.ObjectPartitionID = new Compact64bitInt(1u);
                objectGroupObjectDeclare.CellReferencesCount = new Compact64bitInt(0u);
                objectGroupObjectDeclare.ObjectReferencesCount = new Compact64bitInt(1u);
                objectGroupObjectDeclare.ObjectDataSize = new Compact64bitInt((ulong)node.ObjectData.LongLength);

                return objectGroupObjectDeclare;
            }
        public static RevisionStoreObjectGroup CreateInstance(ExGuid objectGroupId, ObjectGroupDataElementData dataObject, bool isEncryption)
        {
            RevisionStoreObjectGroup objectGroup = new RevisionStoreObjectGroup(objectGroupId);
            Dictionary <ExGuid, RevisionStoreObject> objectDict = new Dictionary <ExGuid, RevisionStoreObject>();

            if (isEncryption == false)
            {
                RevisionStoreObject revisionObject = null;
                for (int i = 0; i < dataObject.ObjectGroupDeclarations.ObjectDeclarationList.Count; i++)
                {
                    ObjectGroupObjectDeclare objectDeclaration = dataObject.ObjectGroupDeclarations.ObjectDeclarationList[i];
                    ObjectGroupObjectData    objectData        = dataObject.ObjectGroupData.ObjectGroupObjectDataList[i];

                    if (!objectDict.ContainsKey(objectDeclaration.ObjectExtendedGUID))
                    {
                        revisionObject = new RevisionStoreObject();
                        revisionObject.ObjectGroupID = objectGroupId;
                        revisionObject.ObjectID      = objectDeclaration.ObjectExtendedGUID;
                        objectDict.Add(objectDeclaration.ObjectExtendedGUID, revisionObject);
                    }
                    else
                    {
                        revisionObject = objectDict[objectDeclaration.ObjectExtendedGUID];
                    }
                    if (objectDeclaration.ObjectPartitionID.DecodedValue == 4)
                    {
                        revisionObject.JCID = new JCIDObject(objectDeclaration, objectData);
                    }
                    else if (objectDeclaration.ObjectPartitionID.DecodedValue == 1)
                    {
                        revisionObject.PropertySet = new PropertySetObject(objectDeclaration, objectData);
                        if (Convert.ToBoolean(revisionObject.JCID.JCID.IsFileData) == false)
                        {
                            revisionObject.ReferencedObjectID       = objectData.ObjectExGUIDArray;
                            revisionObject.ReferencedObjectSpacesID = objectData.CellIDArray;
                        }
                    }
                }

                for (int i = 0; i < dataObject.ObjectGroupDeclarations.ObjectGroupObjectBLOBDataDeclarationList.Count; i++)
                {
                    ObjectGroupObjectBLOBDataDeclaration objectGroupObjectBLOBDataDeclaration = dataObject.ObjectGroupDeclarations.ObjectGroupObjectBLOBDataDeclarationList[i];
                    ObjectGroupObjectDataBLOBReference   objectGroupObjectDataBLOBReference   = dataObject.ObjectGroupData.ObjectGroupObjectDataBLOBReferenceList[i];
                    if (!objectDict.ContainsKey(objectGroupObjectBLOBDataDeclaration.ObjectExGUID))
                    {
                        revisionObject = new RevisionStoreObject();
                        objectDict.Add(objectGroupObjectBLOBDataDeclaration.ObjectExGUID, revisionObject);
                    }
                    else
                    {
                        revisionObject = objectDict[objectGroupObjectBLOBDataDeclaration.ObjectExGUID];
                    }
                    if (objectGroupObjectBLOBDataDeclaration.ObjectPartitionID.DecodedValue == 2)
                    {
                        revisionObject.FileDataObject = new FileDataObject();
                        revisionObject.FileDataObject.ObjectDataBLOBDeclaration = objectGroupObjectBLOBDataDeclaration;
                        revisionObject.FileDataObject.ObjectDataBLOBReference   = objectGroupObjectDataBLOBReference;
                    }
                }
                objectGroup.Objects.AddRange(objectDict.Values.ToArray());
            }
            else
            {
                for (int i = 0; i < dataObject.ObjectGroupDeclarations.ObjectDeclarationList.Count; i++)
                {
                    ObjectGroupObjectDeclare objectDeclaration = dataObject.ObjectGroupDeclarations.ObjectDeclarationList[i];
                    ObjectGroupObjectData    objectData        = dataObject.ObjectGroupData.ObjectGroupObjectDataList[i];

                    if (objectDeclaration.ObjectPartitionID.DecodedValue == 1)
                    {
                        EncryptionObject encrypObject = new EncryptionObject();
                        encrypObject.ObjectDeclaration = objectDeclaration;
                        encrypObject.ObjectData        = objectData.Data.Content.ToArray();
                        objectGroup.EncryptionObjects.Add(encrypObject);
                    }
                }
            }

            return(objectGroup);
        }
 /// <summary>
 /// Construct the PropertySetObject instance.
 /// </summary>
 /// <param name="objectDeclaration">The Object Declaration structure.</param>
 /// <param name="objectData">The Object Data structure.</param>
 public PropertySetObject(ObjectGroupObjectDeclare objectDeclaration, ObjectGroupObjectData objectData)
 {
     this.ObjectDeclaration        = objectDeclaration;
     this.ObjectSpaceObjectPropSet = new ObjectSpaceObjectPropSet();
     this.ObjectSpaceObjectPropSet.DoDeserializeFromByteArray(objectData.Data.Content.ToArray(), 0);
 }
 /// <summary>
 /// Construct the JCIDObject instance.
 /// </summary>
 /// <param name="objectDeclaration">The Object Declaration structure.</param>
 /// <param name="objectData">The Object Data structure.</param>
 public JCIDObject(ObjectGroupObjectDeclare objectDeclaration, ObjectGroupObjectData objectData)
 {
     this.ObjectDeclaration = objectDeclaration;
     this.JCID = new JCID();
     this.JCID.DoDeserializeFromByteArray(objectData.Data.Content.ToArray(), 0);
 }
        /// <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>
        /// 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>
        /// 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");
        }
Example #9
0
            /// <summary>
            /// This method is used to find the object group data element using the specified extended GUID.
            /// </summary>
            /// <param name="objectGroupList">Specify the object group data element list.</param>
            /// <param name="extendedGuid">Specify the extended GUID.</param>
            /// <param name="declare">Specify the output of ObjectGroupObjectDeclare.</param>
            /// <returns>Return the object group data element if found.</returns>
            /// <exception cref="InvalidOperationException">If not found, throw the InvalidOperationException exception.</exception>
            private ObjectGroupObjectData FindByExGuid(List <ObjectGroupDataElementData> objectGroupList, ExGuid extendedGuid, out ObjectGroupObjectDeclare declare)
            {
                foreach (ObjectGroupDataElementData objectGroup in objectGroupList)
                {
                    int findIndex = objectGroup.ObjectGroupDeclarations.ObjectDeclarationList.FindIndex(objDeclare => objDeclare.ObjectExtendedGUID.Equals(extendedGuid));

                    if (findIndex == -1)
                    {
                        continue;
                    }

                    declare = objectGroup.ObjectGroupDeclarations.ObjectDeclarationList[findIndex];
                    return(objectGroup.ObjectGroupData.ObjectGroupObjectDataList[findIndex]);
                }

                throw new InvalidOperationException("Cannot find the " + extendedGuid.GUID.ToString());
            }
            /// <summary>
            /// This method is used to find the object group data element using the specified extended GUID.
            /// </summary>
            /// <param name="objectGroupList">Specify the object group data element list.</param>
            /// <param name="extendedGuid">Specify the extended GUID.</param>
            /// <param name="declare">Specify the output of ObjectGroupObjectDeclare.</param>
            /// <returns>Return the object group data element if found.</returns>
            /// <exception cref="InvalidOperationException">If not found, throw the InvalidOperationException exception.</exception>
            private ObjectGroupObjectData FindByExGuid(List<ObjectGroupDataElementData> objectGroupList, ExGuid extendedGuid, out ObjectGroupObjectDeclare declare)
            {
                foreach (ObjectGroupDataElementData objectGroup in objectGroupList)
                {
                    int findIndex = objectGroup.ObjectGroupDeclarations.ObjectDeclarationList.FindIndex(objDeclare => objDeclare.ObjectExtendedGUID.Equals(extendedGuid));

                    if (findIndex == -1)
                    {
                        continue;
                    }

                    declare = objectGroup.ObjectGroupDeclarations.ObjectDeclarationList[findIndex];
                    return objectGroup.ObjectGroupData.ObjectGroupObjectDataList[findIndex];
                }

                throw new InvalidOperationException("Cannot find the " + extendedGuid.GUID.ToString());
            }
        /// <summary>
        /// This method is used to test Object 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 VerifyObjectGroupObjectDeclare(ObjectGroupObjectDeclare instance, ITestSite site)
        {
            // If the instance is not null and there are no parsing errors, then the ObjectGroupObjectDeclare related adapter requirements can be directly captured.
            if (null == instance)
            {
                site.Assert.Fail("The instance of type ObjectGroupObjectDeclare 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_R315, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     315,
                     @"[In Object Declaration] Object Group Object Declaration (variable): A 16-bit (section 2.2.1.5.1) or 32-bit stream object header (section 2.2.1.5.2) that specifies an object group object declaration.");

            // Directly capture requirement MS-FSSHTTPB_R316, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     316,
                     @"[In Object Declaration] Object Extended GUID (variable): An extended GUID (section 2.2.1.7) that specifies the object.");

            // Directly capture requirement MS-FSSHTTPB_R317, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     317,
                     @"[In Object Declaration] Object Partition ID (variable): A compact unsigned 64-bit integer (section 2.2.1.1) that specifies the object partition of the object.");

            // Directly capture requirement MS-FSSHTTPB_R318, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     318,
                     @"[In Object Declaration] Object Data Size (variable): A compact unsigned 64-bit integer that specifies the size in bytes of the binary data opaque to this protocol[MS-FSSHTTPB] for the declared object.");

            // Directly capture requirement MS-FSSHTTPB_R319, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     319,
                     @"[In Object Declaration] Object References Count (variable): A compact unsigned 64-bit integer that specifies the number of object references.");

            // Directly capture requirement MS-FSSHTTPB_R320, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     320,
                     @"[In Object Declaration] Cell References Count (variable): A compact unsigned 64-bit integer that specifies the number of cell references.");

            // Verify the stream object header related requirements.
            this.ExpectSingleObject(instance.StreamObjectHeaderStart, site);
        }