public void MSONESTORE_S02_TC05_LoadOneNoteWithLargeReferences()
        {
            string fileName = Common.GetConfigurationPropertyValue("OneWithLarge", Site);

            OneNoteRevisionStoreFile file = this.Adapter.LoadOneNoteFile(fileName);

            int objectSpaceCount = file.RootFileNodeList.ObjectSpaceManifestList.Count;

            for (int i = 0; i < file.RootFileNodeList.ObjectSpaceManifestList.Count; i++)
            {
                ObjectSpaceManifestList objectSpace = file.RootFileNodeList.ObjectSpaceManifestList[i];

                for (int j = 0; j < objectSpace.RevisionManifestList[0].ObjectGroupList.Count; j++)
                {
                    ObjectGroupList objectGroupList = objectSpace.RevisionManifestList[0].ObjectGroupList[j];
                    FileNode[]      fileNodes       = objectGroupList.FileNodeSequence.Where(f => f.FileNodeID == FileNodeIDValues.ObjectDeclarationFileData3LargeRefCountFND).ToArray();

                    foreach (FileNode node in fileNodes)
                    {
                        ObjectDeclarationFileData3LargeRefCountFND fnd = node.fnd as ObjectDeclarationFileData3LargeRefCountFND;

                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R72
                        Site.CaptureRequirementIfIsTrue(
                            (uint)node.FileNodeID == 0x073 && fnd.jcid.IsFileData == 1,
                            72,
                            @"[In Object Space Object]If the value of the JCID.IsFileData field is ""true"" then the value of the FileNode.FileNodeID field MUST be [0x072 (ObjectDeclarationFileData3RefCountFND structure, section 2.5.27) or] 0x073 (ObjectDeclarationFileData3LargeRefCountFND structure, section 2.5.28).");
                    }
                }
            }
        }
Exemple #2
0
        public void MSONESTORE_S01_TC01_QueryOneFileContainsFileData()
        {
            // Get the resource url that contains the file data.
            string resourceName = Common.GetConfigurationPropertyValue("OneFileWithFileData", Site);
            string url          = this.GetResourceUrl(resourceName);

            this.InitializeContext(url, this.UserName, this.Password, this.Domain);

            // Call QueryChange to get the data that is specified by above step.
            CellSubRequestType  cellSubRequest      = this.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentSerialNumber());
            CellStorageResponse cellStorageResponse = this.SharedAdapter.CellStorageRequest(url, new SubRequestType[] { cellSubRequest });
            MSOneStorePackage   package             = this.ConvertOneStorePackage(cellStorageResponse);

            // Call adapter to load same file in local.
            OneNoteRevisionStoreFile file    = this.Adapter.LoadOneNoteFile(resourceName);
            int             objectSpaceCount = file.RootFileNodeList.ObjectSpaceManifestList.Count;
            List <FileNode> fileData3Refs    = new List <FileNode>();

            for (int i = 0; i < file.RootFileNodeList.ObjectSpaceManifestList.Count; i++)
            {
                ObjectSpaceManifestList objectSpace = file.RootFileNodeList.ObjectSpaceManifestList[i];
                for (int j = 0; j < objectSpace.RevisionManifestList[0].ObjectGroupList.Count; j++)
                {
                    ObjectGroupList objectGroupList = objectSpace.RevisionManifestList[0].ObjectGroupList[j];
                    fileData3Refs.AddRange(objectGroupList.FileNodeSequence.Where(f => f.FileNodeID == FileNodeIDValues.ObjectDeclarationFileData3RefCountFND).ToArray());
                }
            }

            #region Capture code for Revisions
            ExGuid rootObjectId = package.DataRoot[0].ObjectGroupID;
            RevisionManifestDataElementData rootRevision = package.RevisionManifests[0];

            // Verify MS-ONESTORE requirement: MS-ONESTORE_R933
            Site.CaptureRequirementIfAreEqual <ExGuid>(
                rootObjectId,
                rootRevision.RevisionManifestObjectGroupReferencesList[0].ObjectGroupExtendedGUID,
                933,
                @"[In Revisions] The Object Extended GUID field in the Revision Manifest Data Element structure MUST be equal to the identity of the corresponding root object in the revision in the revision store.");
            #endregion

            #region Capture code for Objects
            List <RevisionStoreObject> objectsWithFileData = new List <RevisionStoreObject>();
            foreach (RevisionStoreObjectGroup objGroup in package.DataRoot)
            {
                objectsWithFileData.AddRange(objGroup.Objects.Where(o => o.FileDataObject != null).ToArray());
            }
            foreach (RevisionStoreObjectGroup objGroup in package.OtherFileNodeList)
            {
                objectsWithFileData.AddRange(objGroup.Objects.Where(o => o.FileDataObject != null).ToArray());
            }
            string           subResponseBase64  = cellStorageResponse.ResponseCollection.Response[0].SubResponse[0].SubResponseData.Text[0];
            byte[]           subResponseBinary  = Convert.FromBase64String(subResponseBase64);
            FsshttpbResponse fsshttpbResponse   = FsshttpbResponse.DeserializeResponseFromByteArray(subResponseBinary, 0);
            DataElement[]    objectBlOBElements = fsshttpbResponse.DataElementPackage.DataElements.Where(d => d.DataElementType == DataElementType.ObjectDataBLOBDataElementData).ToArray();

            foreach (RevisionStoreObject obj in objectsWithFileData)
            {
                Guid   fileDataObjectGuid = this.GetFileDataObjectGUID(obj);
                string extension          = this.GetFileDataObjectExtension(obj);
                bool   isFoundBLOB        =
                    objectBlOBElements.Where(b => b.DataElementExtendedGUID.Equals(obj.FileDataObject.ObjectDataBLOBReference.BLOBExtendedGUID)).ToArray().Length > 0;

                // Verify MS-ONESTORE requirement: MS-ONESTORE_R948
                Site.CaptureRequirementIfIsTrue(
                    isFoundBLOB && obj.FileDataObject.ObjectDataBLOBDeclaration.ObjectPartitionID.DecodedValue == 2,
                    948,
                    @"[In Objects] Object Data BLOB Declaration.PartitionID: 2 (File Data) and Object Data BLOB Reference. BLOB Extended GUID: MUST have a reference to an Object Data BLOB Data Element structure, as specified in [MS-FSSHTTPB] section 2.2.1.12.8, used to transmit the data of the file data object.");

                foreach (FileNode fn in fileData3Refs)
                {
                    ObjectDeclarationFileData3RefCountFND fnd = fn.fnd as ObjectDeclarationFileData3RefCountFND;
                    if (fnd.FileDataReference.StringData.ToLower().Contains(fileDataObjectGuid.ToString().ToLower()))
                    {
                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R951
                        Site.CaptureRequirementIfIsTrue(
                            fnd.FileDataReference.StringData.StartsWith("<invfdo>") == false,
                            951,
                            @"[In Objects] This property MUST be set only if the prefix specified by the ObjectDeclarationFileData3RefCountFND.FileDataReference field (section 2.5.27) [or ObjectDeclarationFileData3LargeRefCountFND.FileDataReference field (section 2.5.28)] is not <invfdo>.");


                        Site.CaptureRequirementIfAreEqual <string>(
                            fnd.Extension.StringData,
                            extension,
                            958,
                            @"[In Objects] MUST be the value specified by the ObjectDeclarationFileData3RefCountFND.Extension field [or the ObjectDeclarationFileData3LargeRefCountFND.Extension] field.");
                        break;
                    }
                }
            }
            #endregion
        }
        public void MSONESTORE_S02_TC01_LoadOneNoteFileWithFileData()
        {
            string fileName = Common.GetConfigurationPropertyValue("OneFileWithFileData", Site);

            OneNoteRevisionStoreFile file = this.Adapter.LoadOneNoteFile(fileName);

            for (int i = 0; i <= file.RootFileNodeList.FileNodeListFragments.Count - 1; i++)
            {
                bool isDifferent = file.RootFileNodeList.FileNodeListFragments[i].Header.FileNodeListID != file.RootFileNodeList.FileNodeListFragments[i].Header.nFragmentSequence;

                // Verify MS-ONESTORE requirement: MS-ONESTORE_R3911
                Site.CaptureRequirementIfIsTrue(
                    isDifferent,
                    3911,
                    @"[In FileNodeListHeader] The pair of FileNodeListID and nFragmentSequence field in FileNodeListFragment structures in the file, is different.");
            }

            List <RevisionManifest> revisManifestList = new List <RevisionManifest>();

            foreach (ObjectSpaceManifestList objSpaceManifestList in file.RootFileNodeList.ObjectSpaceManifestList)
            {
                foreach (RevisionManifestList revManifestList in objSpaceManifestList.RevisionManifestList)
                {
                    revisManifestList.AddRange(revManifestList.RevisionManifests);
                }
            }

            List <ExtendedGUID> ridRevisionManifestStart6FND          = new List <ExtendedGUID>();
            List <ExtendedGUID> ridDependentRevisionManifestStart6FND = new List <ExtendedGUID>();
            List <ExtendedGUID> ridRevisionManifestStart7FND          = new List <ExtendedGUID>();
            List <ExtendedGUID> ridDependentRevisionManifestStart7FND = new List <ExtendedGUID>();
            List <uint>         odcsDefault = new List <uint>();

            for (int i = 0; i < revisManifestList.Count; i++)
            {
                for (int j = 0; j < revisManifestList[i].FileNodeSequence.Count; j++)
                {
                    FileNode revision = revisManifestList[i].FileNodeSequence[j];

                    if (revision.FileNodeID == FileNodeIDValues.RevisionManifestStart6FND)
                    {
                        RevisionManifestStart6FND fnd = revision.fnd as RevisionManifestStart6FND;
                        ridRevisionManifestStart6FND.Add(((RevisionManifestStart6FND)revision.fnd).rid);
                        ridDependentRevisionManifestStart6FND.Add(((RevisionManifestStart6FND)revision.fnd).ridDependent);
                        odcsDefault.Add(((RevisionManifestStart6FND)revision.fnd).odcsDefault);
                    }

                    if (revision.FileNodeID == FileNodeIDValues.RevisionManifestStart7FND)
                    {
                        RevisionManifestStart7FND fnd = revision.fnd as RevisionManifestStart7FND;
                        ridRevisionManifestStart7FND.Add(((RevisionManifestStart7FND)revision.fnd).Base.rid);
                        ridDependentRevisionManifestStart7FND.Add(((RevisionManifestStart7FND)revision.fnd).Base.ridDependent);
                    }
                }
            }

            for (int i = 0; i < odcsDefault.Count - 1; i++)
            {
                // Verify MS-ONESTORE requirement: MS-ONESTORE_R535
                Site.CaptureRequirementIfAreEqual <uint>(
                    odcsDefault[i],
                    odcsDefault[i + 1],
                    535,
                    @"[In RevisionManifestStart6FND] [odcsDefault] MUST specify the same type of data encoding as used in the dependency revision (section 2.1.8), if one was specified in the ridDependent field.");
            }

            ExtendedGUID zeroExtendGuid = new ExtendedGUID();

            zeroExtendGuid.Guid = Guid.Empty;
            zeroExtendGuid.N    = 0;

            for (int i = 0; i < ridRevisionManifestStart6FND.Count - 1; i++)
            {
                for (int j = i + 1; j < ridRevisionManifestStart6FND.Count; j++)
                {
                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R52501
                    Site.CaptureRequirementIfAreNotEqual <ExtendedGUID>(
                        ridRevisionManifestStart6FND[i],
                        ridRevisionManifestStart6FND[j],
                        52501,
                        @"[In RevisionManifestStart6FND] The rid of two RevisionManifestStart6FND in revision manifest list is different.");
                }

                if (ridDependentRevisionManifestStart6FND[i].Equals(zeroExtendGuid))
                {
                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R527
                    Site.CaptureRequirementIfAreNotEqual <ExtendedGUID>(
                        zeroExtendGuid,
                        ridRevisionManifestStart6FND[i],
                        527,
                        @"[In RevisionManifestStart6FND] [ridDependent] If the value is ""{ { 00000000 - 0000 - 0000 - 0000 - 000000000000}, 0}
                "", then this revision manifest has no dependency revision. ");
                }
                else
                {
                    if (!ridDependentRevisionManifestStart6FND[i + 1].Equals(zeroExtendGuid))
                    {
                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R528
                        Site.CaptureRequirementIfAreEqual <ExtendedGUID>(
                            ridRevisionManifestStart6FND[i],
                            ridDependentRevisionManifestStart6FND[i + 1],
                            528,
                            @"[In RevisionManifestStart6FND] [ridDependent] Otherwise[If the value is not ""{ { 00000000 - 0000 - 0000 - 0000 - 000000000000}, 0}
                    ""], this value MUST be equal to the RevisionManifestStart6FND.rid field [or the RevisionManifestStart7FND.base.rid field] of a previous revision manifest within this revision manifest list.");
                    }
                }
            }

            for (int i = 0; i < ridRevisionManifestStart7FND.Count - 1; i++)
            {
                for (int j = i + 1; j < ridRevisionManifestStart7FND.Count; j++)
                {
                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R52502
                    Site.CaptureRequirementIfAreNotEqual <ExtendedGUID>(
                        ridRevisionManifestStart7FND[i],
                        ridRevisionManifestStart7FND[i + 1],
                        52502,
                        @"[In RevisionManifestStart6FND] The rid of two RevisionManifestStart7FND in revision manifest list is different.");
                }

                if (!ridDependentRevisionManifestStart7FND[i].Equals(zeroExtendGuid) && !ridDependentRevisionManifestStart7FND[i + 1].Equals(zeroExtendGuid))
                {
                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R52801
                    Site.CaptureRequirementIfAreEqual <ExtendedGUID>(
                        ridRevisionManifestStart7FND[i],
                        ridDependentRevisionManifestStart7FND[i + 1],
                        52801,
                        @"[In RevisionManifestStart6FND] [ridDependent] Otherwise[If the value is not ""{ { 00000000 - 0000 - 0000 - 0000 - 000000000000}, 0}
                    ""], this value MUST be equal to [the RevisionManifestStart6FND.rid field or] the RevisionManifestStart7FND.base.rid field of a previous revision manifest within this revision manifest list.");
                }
            }
            foreach (ObjectSpaceManifestList objectSpaceManifestList in file.RootFileNodeList.ObjectSpaceManifestList)
            {
                foreach (RevisionManifestList revisionManifestList in objectSpaceManifestList.RevisionManifestList)
                {
                    if (revisionManifestList.FileNodeListFragments.Count > 1)
                    {
                        for (int i = 0; i < revisionManifestList.FileNodeListFragments.Count - 1; i++)
                        {
                            for (int j = i + 1; j < revisionManifestList.FileNodeListFragments.Count; j++)
                            {
                                // Verify MS-ONESTORE requirement: MS-ONESTORE_R366
                                Site.CaptureRequirementIfAreEqual <uint>(
                                    revisionManifestList.FileNodeListFragments[i].Header.FileNodeListID,
                                    revisionManifestList.FileNodeListFragments[j].Header.FileNodeListID,
                                    366,
                                    @"[In FileNodeListFragment] All fragments in the same file node list MUST have the same FileNodeListFragment.header.FileNodeListID field.");
                            }
                        }
                    }

                    foreach (FileNodeListFragment fileNodeListFragment in revisionManifestList.FileNodeListFragments)
                    {
                        FileChunkReference64x32 nextFragment = fileNodeListFragment.nextFragment;
                        if ((uint)fileNodeListFragment.rgFileNodes[fileNodeListFragment.rgFileNodes.Count - 1].FileNodeID == 0xFF)
                        {
                            // Verify MS-ONESTORE requirement: MS-ONESTORE_R373
                            Site.CaptureRequirementIfIsInstanceOfType(
                                nextFragment,
                                typeof(FileChunkReference64x32),
                                373,
                                @"[In FileNodeListFragment] [rgFileNodes If a ChunkTerminatorFND structure is present, the value of the nextFragment field MUST be a valid FileChunkReference64x32 structure (section 2.2.4.4) to the next FileNodeListFragment structure.");
                        }

                        if (nextFragment == revisionManifestList.FileNodeListFragments[revisionManifestList.FileNodeListFragments.Count - 1].nextFragment)
                        {
                            // Verify MS-ONESTORE requirement: MS-ONESTORE_R379
                            Site.CaptureRequirementIfIsTrue(
                                nextFragment.IsfcrNil(),
                                379,
                                @"[In FileNodeListFragment] If this is the last fragment, the value of the nextFragment field MUST be ""fcrNil"" (see section 2.2.4). ");
                        }
                        else
                        {
                            // Verify MS-ONESTORE requirement: MS-ONESTORE_R380
                            Site.CaptureRequirementIfIsFalse(
                                nextFragment.IsfcrZero() || nextFragment.IsfcrNil(),
                                380,
                                @"[In FileNodeListFragment] Otherwise [If this is not the last fragment] the value of the nextFragment.stp field MUST specify the location of a valid FileNodeListFragment structure, and the value of the nextFragment.cb field MUST be equal to the size of the referenced fragment including the FileNodeListFragment.header field and the FileNodeListFragment.footer field.");
                        }
                    }
                }
            }

            bool isFileNode = false;

            foreach (FileNode fileDataStoreList in file.RootFileNodeList.FileDataStoreListReference)
            {
                FileDataStoreListReferenceFND fnd = fileDataStoreList.fnd as FileDataStoreListReferenceFND;

                for (int i = 0; i < fnd.fileNodeListFragment.rgFileNodes.Count - 1; i++)
                {
                    for (int j = i + 1; j < fnd.fileNodeListFragment.rgFileNodes.Count; j++)
                    {
                        FileDataStoreObjectReferenceFND objfnd1 = fnd.fileNodeListFragment.rgFileNodes[i].fnd as FileDataStoreObjectReferenceFND;
                        FileDataStoreObjectReferenceFND objfnd2 = fnd.fileNodeListFragment.rgFileNodes[j].fnd as FileDataStoreObjectReferenceFND;

                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R63701
                        Site.CaptureRequirementIfAreNotEqual <Guid>(
                            objfnd1.guidReference,
                            objfnd2.guidReference,
                            63701,
                            @"[In FileDataStoreObjectReferenceFND] The guidReference is different for two FileDataStoreObjectReferenceFND structures.");
                    }
                }

                isFileNode = true;

                for (int k = 0; k < fnd.fileNodeListFragment.rgFileNodes.Count; k++)
                {
                    FileNode fileNode = fnd.fileNodeListFragment.rgFileNodes[k];
                    if ((uint)fileNode.FileNodeID != 0x094)
                    {
                        isFileNode = false;
                        break;
                    }

                    // Verify MS-ONESTORE requirement: MS-ONESTORE_R628
                    Site.CaptureRequirementIfIsTrue(
                        isFileNode,
                        628,
                        @"[In FileDataStoreListReferenceFND] The referenced file node list MUST contain only FileNode structures with a FileNodeID field value equal to 00x094 (FileDataStoreObjectReferenceFND structure). ");

                    //If MS-ONESTORE_R628 is verified successfully and according to the definition of FileDataStoreObjectReferenceFND, MS-ONESTORE_R33 can be verified directlly.
                    //Verify MS-ONESTORE requirement: MS-ONESTORE_R633
                    Site.CaptureRequirement(
                        633,
                        @"[[In FileDataStoreObjectReferenceFND] All such FileNode structures MUST be contained in the file node list (section 2.4) specified by a FileDataStoreListReferenceFND structure (section 2.5.21).");
                }
            }

            int objectSpaceCount = file.RootFileNodeList.ObjectSpaceManifestList.Count;

            for (int i = 0; i < file.RootFileNodeList.ObjectSpaceManifestList.Count; i++)
            {
                ObjectSpaceManifestList objectSpace = file.RootFileNodeList.ObjectSpaceManifestList[i];

                for (int j = 0; j < objectSpace.RevisionManifestList[0].ObjectGroupList.Count; j++)
                {
                    ObjectGroupList objectGroupList = objectSpace.RevisionManifestList[0].ObjectGroupList[j];
                    FileNode[]      fileNodes       = objectGroupList.FileNodeSequence.Where(f => f.FileNodeID == FileNodeIDValues.ReadOnlyObjectDeclaration2RefCountFND).ToArray();

                    foreach (FileNode node in fileNodes)
                    {
                        ReadOnlyObjectDeclaration2RefCountFND fnd = node.fnd as ReadOnlyObjectDeclaration2RefCountFND;

                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R68
                        Site.CaptureRequirementIfIsTrue(
                            (uint)node.FileNodeID == 0x0C4 && fnd.Base.body.jcid.IsReadOnly == 1,
                            68,
                            @"[In Object Space Object] If the value of the JCID.IsReadOnly field is ""true"" then the value of the FileNode.FileNodeID field MUST be 0x0C4 (ReadOnlyObjectDeclaration2RefCountFND structure, section 2.5.29) [or 0x0C5 (ReadOnlyObjectDeclaration2LargeRefCountFND structure, section 2.5.30).]");

                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R703
                        Site.CaptureRequirementIfIsNotNull(
                            fnd.Base,
                            703,
                            @"[In ReadOnlyObjectDeclaration2RefCountFND] If this object is revised, all declarations of this object MUST specify identical data. ");
                    }

                    fileNodes = objectGroupList.FileNodeSequence.Where(f => f.FileNodeID == FileNodeIDValues.ObjectDeclarationFileData3RefCountFND).ToArray();

                    foreach (FileNode node in fileNodes)
                    {
                        ObjectDeclarationFileData3RefCountFND fnd = node.fnd as ObjectDeclarationFileData3RefCountFND;

                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R71
                        Site.CaptureRequirementIfIsTrue(
                            (uint)node.FileNodeID == 0x072 && fnd.jcid.IsFileData == 1,
                            71,
                            @"[In Object Space Object]If the value of the JCID.IsFileData field is ""true"" then the value of the FileNode.FileNodeID field MUST be 0x072 (ObjectDeclarationFileData3RefCountFND structure, section 2.5.27) [or 0x073 (ObjectDeclarationFileData3LargeRefCountFND structure, section 2.5.28). ]");
                    }

                    fileNodes = objectGroupList.FileNodeSequence.Where(f => f.FileNodeID == FileNodeIDValues.ReadOnlyObjectDeclaration2LargeRefCountFND).ToArray();

                    foreach (FileNode node in fileNodes)
                    {
                        ReadOnlyObjectDeclaration2LargeRefCountFND fnd = node.fnd as ReadOnlyObjectDeclaration2LargeRefCountFND;

                        // Verify MS-ONESTORE requirement: MS-ONESTORE_R710
                        Site.CaptureRequirementIfIsNotNull(
                            fnd.Base,
                            710,
                            @"[In ReadOnlyObjectDeclaration2LargeRefCountFND] If this object is revised, all declarations of this object MUST specify identical data. ");
                    }
                    fileNodes = objectGroupList.FileNodeSequence.Where(f => f.FileNodeID == FileNodeIDValues.DataSignatureGroupDefinitionFND).ToArray();

                    List <ExtendedGUID> dataSignatureGroupdefinitionFND = new List <ExtendedGUID>();

                    for (int k = 0; k < fileNodes.Length - 1; k++)
                    {
                        DataSignatureGroupDefinitionFND fnd = fileNodes[k].fnd as DataSignatureGroupDefinitionFND;
                        if (!fnd.DataSignatureGroup.Equals(zeroExtendGuid))
                        {
                            dataSignatureGroupdefinitionFND.Add(fnd.DataSignatureGroup);
                        }
                    }

                    for (int k = 0; k < dataSignatureGroupdefinitionFND.Count - 1; k++)
                    {
                        for (int h = k + 1; h < dataSignatureGroupdefinitionFND.Count; h++)
                        {
                            // Verify MS-ONESTORE requirement: MS-ONESTORE_R72701
                            Site.CaptureRequirementIfAreEqual <ExtendedGUID>(
                                dataSignatureGroupdefinitionFND[k],
                                dataSignatureGroupdefinitionFND[h],
                                72701,
                                @"[In DataSignatureGroupDefinitionFND] DataSignatureGroup (20 bytes):All declarations of an object (section 2.1.5) with the same identity and the same DataSignatureGroup field not equal to {{00000000-0000-0000-0000-000000000000}, 0} MUST have the same data.");
                        }
                    }
                }
            }
        }
Exemple #4
0
        public void MSONESTORE_S01_TC04_QueryOneFileWithLargeReferences()
        {
            // Get the resource url that contains the file data.
            string resourceName = Common.GetConfigurationPropertyValue("OneWithLarge", Site);
            string url          = this.GetResourceUrl(resourceName);

            this.InitializeContext(url, this.UserName, this.Password, this.Domain);

            // Call QueryChange to get the data that is specified by above step.
            CellSubRequestType  cellSubRequest      = this.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentSerialNumber());
            CellStorageResponse cellStorageResponse = this.SharedAdapter.CellStorageRequest(url, new SubRequestType[] { cellSubRequest });
            MSOneStorePackage   package             = this.ConvertOneStorePackage(cellStorageResponse);

            // Call adapter to load same file in local.
            OneNoteRevisionStoreFile file      = this.Adapter.LoadOneNoteFile(resourceName);
            int             objectSpaceCount   = file.RootFileNodeList.ObjectSpaceManifestList.Count;
            List <FileNode> fileData3LargeRefs = new List <FileNode>();

            for (int i = 0; i < file.RootFileNodeList.ObjectSpaceManifestList.Count; i++)
            {
                ObjectSpaceManifestList objectSpace = file.RootFileNodeList.ObjectSpaceManifestList[i];
                for (int j = 0; j < objectSpace.RevisionManifestList[0].ObjectGroupList.Count; j++)
                {
                    ObjectGroupList objectGroupList = objectSpace.RevisionManifestList[0].ObjectGroupList[j];
                    fileData3LargeRefs.AddRange(objectGroupList.FileNodeSequence.Where(f => f.FileNodeID == FileNodeIDValues.ObjectDeclarationFileData3LargeRefCountFND).ToArray());
                }
            }

            List <RevisionStoreObject> objectsWithFileData = new List <RevisionStoreObject>();

            foreach (RevisionStoreObjectGroup objGroup in package.DataRoot)
            {
                objectsWithFileData.AddRange(objGroup.Objects.Where(o => o.FileDataObject != null).ToArray());
            }
            foreach (RevisionStoreObjectGroup objGroup in package.OtherFileNodeList)
            {
                objectsWithFileData.AddRange(objGroup.Objects.Where(o => o.FileDataObject != null).ToArray());
            }
            foreach (RevisionStoreObject obj in objectsWithFileData)
            {
                Guid   fileDataObjectGuid = this.GetFileDataObjectGUID(obj);
                string extension          = this.GetFileDataObjectExtension(obj);

                if (extension.ToLower().Contains("xps"))
                {
                    foreach (FileNode fnode in fileData3LargeRefs)
                    {
                        ObjectDeclarationFileData3LargeRefCountFND fnd = fnode.fnd as ObjectDeclarationFileData3LargeRefCountFND;
                        if (fnd.FileDataReference.StringData.ToLower().Contains(fileDataObjectGuid.ToString().ToLower()))
                        {
                            // Verify MS-ONESTORE requirement: MS-ONESTORE_R952
                            Site.CaptureRequirementIfIsTrue(
                                fnd.FileDataReference.StringData.StartsWith("<invfdo>") == false,
                                952,
                                @"[In Objects] This property MUST be set only if the prefix specified by the [ObjectDeclarationFileData3RefCountFND.FileDataReference field (section 2.5.27) or] ObjectDeclarationFileData3LargeRefCountFND.FileDataReference field (section 2.5.28) is not <invfdo>.");

                            // Verify MS-ONESTORE requirement: MS-ONESTORE_R959
                            Site.CaptureRequirementIfAreEqual <string>(
                                fnd.Extension.StringData,
                                extension,
                                959,
                                @"[In Objects] MUST be the value specified by the [ObjectDeclarationFileData3RefCountFND.Extension field or] the ObjectDeclarationFileData3LargeRefCountFND.Extension field.");

                            break;
                        }
                    }
                }
            }
        }