コード例 #1
0
        /// <summary>
        /// Verify the message syntax In FILE_FS_ATTRIBUTE_INFORMATION
        /// </summary>
        /// <param name="fileFsAttributeInformation">A FileFsAttributeInformation type structure.</param>
        /// <param name="maximumFileNameComponentLength">The maximum file name component length, in bytes, supported by the specified file system.</param>
        public void VerifyMessageSyntaxFileFsAttributeInformation(
            FileFsAttributeInformation fileFsAttributeInformation,
            int maximumFileNameComponentLength)
        {
            Site.DefaultProtocolDocShortName = "MS-FSCC";
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1684");

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1684
            //
            // If FILE_FS_ATTRIBUTE_INFORMATION is not null in this message, then mean the message contains it, so can capture this requirement just by verifying this field is not null
            Site.CaptureRequirementIfIsNotNull(
                fileFsAttributeInformation,
                1684,
                @"The message[FileFsAttributeInformation] contains a FILE_FS_ATTRIBUTE_INFORMATION data element.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1703,the value of FileSystemAttributes is {0}", fileFsAttributeInformation.FileSystemAttributes);

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1703
            //
            // If the two flags don't equal 1 at the same time, then means they are incompatible
            FileSystemAttributes_Values flagsOr = (FileSystemAttributes_Values.FILE_FILE_COMPRESSION | FileSystemAttributes_Values.FILE_VOLUME_IS_COMPRESSED);

            bool isVerifyR1703 =
                (fileFsAttributeInformation.FileSystemAttributes & flagsOr) != flagsOr;

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1703,
                1703,
                @"[In FILE_FS_ATTRIBUTE_INFORMATION]FileSystemAttributes (4 bytes):  This flag[FILE_FILE_COMPRESSION 0x00000010] is incompatible with the FILE_VOLUME_IS_COMPRESSED flag.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1697,the value of FileSystemAttributes is {0}", fileFsAttributeInformation.FileSystemAttributes);

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1697
            //
            // The same logic with R1703
            Site.CaptureRequirementIfIsTrue(
                isVerifyR1703,
                1697,
                @"[In FILE_FS_ATTRIBUTE_INFORMATION]FileSystemAttributes (4 bytes): This flag[FILE_VOLUME_IS_COMPRESSED 0x00008000] is incompatible with the FILE_FILE_COMPRESSION flag.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1711,the value of FileSystemNameLength is {0}", fileFsAttributeInformation.FileSystemNameLength);

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1711
            //
            bool isVerifyR1711 =
                (Marshal.SizeOf(fileFsAttributeInformation.FileSystemNameLength) == 4) &&
                (fileFsAttributeInformation.FileSystemNameLength == fileFsAttributeInformation.FileSystemName.Length);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1711,
                1711,
                @"[In FILE_FS_ATTRIBUTE_INFORMATION]FileSystemNameLength (4 bytes):  A 32-bit unsigned integer that contains the length, in bytes, of the file system name in the FileSystemName field.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1712,the value of FileSystemNameLength is {0}", fileFsAttributeInformation.FileSystemNameLength);

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1712
            //

            Site.CaptureRequirementIfIsTrue(
                fileFsAttributeInformation.FileSystemNameLength > 0,
                1712,
                @"[In FILE_FS_ATTRIBUTE_INFORMATION]FileSystemNameLength (4 bytes):  The value of this field MUST be greater than 0.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1709,the value of MaximumComponentNameLength is {0}", fileFsAttributeInformation.MaximumComponentNameLength);

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1709
            //
            bool isVerifyR1709 =
                (Marshal.SizeOf(fileFsAttributeInformation.MaximumComponentNameLength) == 4) &&
                (fileFsAttributeInformation.MaximumComponentNameLength == maximumFileNameComponentLength);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1709,
                1709,
                @"[In FILE_FS_ATTRIBUTE_INFORMATION]MaximumComponentNameLength (4 bytes):  A 32-bit signed integer that contains the maximum file name component length, in bytes, supported by the specified file system.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1710,the value of MaximumComponentNameLength is {0}", fileFsAttributeInformation.MaximumComponentNameLength);

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1710
            //

            Site.CaptureRequirementIfIsTrue(
                fileFsAttributeInformation.MaximumComponentNameLength > 0,
                1710,
                @"[In FILE_FS_ATTRIBUTE_INFORMATION]MaximumComponentNameLength (4 bytes): The value of this field MUST be greater than 0.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1716");

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1716
            //
            Site.CaptureRequirementIfAreEqual<uint>(
                fileFsAttributeInformation.FileSystemNameLength,
                (uint)fileFsAttributeInformation.FileSystemName.Length,
                1716,
                @"[In FILE_FS_ATTRIBUTE_INFORMATION]FileSystemName (variable): This field MUST be handled as a sequence of FileSystemNameLength bytes.");

            Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"];
        }
コード例 #2
0
        public void VerifyDataTypeFileFsAttributeInformation(FileFsAttributeInformation info)
        {
            Site.DefaultProtocolDocShortName = "MS-FSCC";
            string ServerOS = Site.Properties["ServerOSPlatform"];

            // check if OS is not the specified one, FILE_READ_ONLY_VOLUME is not set
            if (ServerOS != "WinXP" && ServerOS != "Win2k3" && ServerOS != "WinVista" && ServerOS != "Win2k8")
            {

                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1967. FileSystemAttributes: {0}", info.FileSystemAttributes);

                //
                // Verify MS-FSCC requirement: MS-FSCC_R1967
                //
                // check FILE_READ_ONLY_VOLUME bit is not set
                bool isVerifyR1967 = ((info.FileSystemAttributes & FileSystemAttributes_Values.FILE_READ_ONLY_VOLUME) == 0);

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR1967,
                    1967,
                    @"<76> Section 2.5.1: This attribute[FILE_READ_ONLY_VOLUME 0x00080000] is only available on Windows?XP,
                    Windows Server?2003, Windows?Vista, and Windows Server?2008.");
            }

            if (ServerOS == "WinVistaSP1" || ServerOS == "Win2k8" || ServerOS == "Win7")
            {

                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1972. FileSystemName: {0}", info.FileSystemName);

                //
                // Verify MS-FSCC requirement: MS-FSCC_R1972
                //
                bool isVerifyR1972 = (info.FileSystemName.Equals("FAT") ||
                                      info.FileSystemName.Equals("FAT16") ||
                                      info.FileSystemName.Equals("FAT32") ||
                                      info.FileSystemName.Equals("exFAT") ||
                                      info.FileSystemName.Equals("NTFS") ||
                                      info.FileSystemName.Equals("CDFS") ||
                                      info.FileSystemName.Equals("UDF"));

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR1972,
                    1972,
                    @"<79> Section 2.5.1: For Windows?Vista SP1 and Windows Server?2008, valid values [for FileSystemName]
                    are: ""FAT"",""FAT16"",""FAT32"",""exFAT"",""NTFS"",""CDFS"",and ""UDF"".");

                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1971. FileSystemName: {0}", info.FileSystemName);

                //
                // Verify MS-FSCC requirement: MS-FSCC_R1971
                //
                bool isVerifyR1971 = (info.FileSystemName.Equals("FAT") ||
                                      info.FileSystemName.Equals("FAT16") ||
                                      info.FileSystemName.Equals("FAT32") ||
                                      info.FileSystemName.Equals("exFAT") ||
                                      info.FileSystemName.Equals("NTFS") ||
                                      info.FileSystemName.Equals("CDFS") ||
                                      info.FileSystemName.Equals("UDF"));

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR1971,
                    1971,
                    @"<79> Section 2.5.1:For Windows 7, valid values [for FileSystemName] are: ""FAT"",""FAT16"",""FAT32"",""exFAT"",""NTFS"",""CDFS"",""UDF"".");
            }

            if (ServerOS == "WinXP")
            {

                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1974. FileSystemName: {0}", info.FileSystemName);

                //
                // Verify MS-FSCC requirement: MS-FSCC_R1974
                //
                bool isVerifyR1974 = (info.FileSystemName.Equals("FAT") ||
                                      info.FileSystemName.Equals("FAT16") ||
                                      info.FileSystemName.Equals("FAT32") ||
                                      info.FileSystemName.Equals("NTFS") ||
                                      info.FileSystemName.Equals("CDFS"));

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR1974,
                    1974,
                    @"<79> Section 2.5.1: For Windows?XP, valid values [for FileSystemName] are: ""FAT"",""FAT16"",""FAT32"",""NTFS"",and ""CDFS"".");
            }

            if (ServerOS == "WinVista")
            {

                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1973. FileSystemName: {0}", info.FileSystemName);

                //
                // Verify MS-FSCC requirement: MS-FSCC_R1973
                //
                bool isVerifyR1973 = (info.FileSystemName.Equals("FAT") ||
                                      info.FileSystemName.Equals("FAT16") ||
                                      info.FileSystemName.Equals("FAT32") ||
                                      info.FileSystemName.Equals("NTFS") ||
                                      info.FileSystemName.Equals("CDFS") ||
                                      info.FileSystemName.Equals("UDF"));

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR1973,
                    1973,
                    @"<79> Section 2.5.1:For Windows?Vista RTM, valid values [for FileSystemName] are: ""FAT"",""FAT16"",
                    ""FAT32"",""NTFS"",""CDFS"",and ""UDF"".");
            }

            Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"];
        }
コード例 #3
0
        /// <summary>
        /// Verify data type FileFsAttributeInformation
        /// </summary>
        /// <param name="fileFsAttributeInformation"> FileFsAttributeInformation type data </param>
        public void VerifyDataTypeFileFsAttributeInformationForOld(
            FileFsAttributeInformation fileFsAttributeInformation)
        {
            Site.DefaultProtocolDocShortName = "MS-FSCC";
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1684");
            //
            // Verify requirement 1684
            //
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(FileFsAttributeInformation),
                fileFsAttributeInformation.GetType(),
                1684,
                @"The message[FileFsAttributeInformation] contains a FILE_FS_ATTRIBUTE_INFORMATION data element.");

            // if fileFsAttributeInformation.FileSystemAttributes  contains FILE_FILE_COMPRESSION or FILE_VOLUME_IS_COMPRESSED
            if ((fileFsAttributeInformation.FileSystemAttributes & FileSystemAttributes_Values.FILE_FILE_COMPRESSION) == FileSystemAttributes_Values.FILE_FILE_COMPRESSION ||
                (fileFsAttributeInformation.FileSystemAttributes & FileSystemAttributes_Values.FILE_VOLUME_IS_COMPRESSED) == FileSystemAttributes_Values.FILE_VOLUME_IS_COMPRESSED)
            {
                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug,
                    "Verify MS-FSCC_R1703 Actual FileSystemAttributes: {0}",
                    fileFsAttributeInformation.FileSystemAttributes);
                //
                // Verify requirement 1703
                //
                // Incompatible means FILE_FILE_COMPRESSION and FILE_VOLUME_IS_COMPRESSED cannot both apear in FileSystemAttrubutes
                uint fileSystemAttributesBitUsed = (uint)(FileSystemAttributes_Values.FILE_VOLUME_IS_COMPRESSED | FileSystemAttributes_Values.FILE_FILE_COMPRESSION);

                // Verify the value of FileSystemAttributes
                bool isVerifyR1703 = (
                    (((uint)fileFsAttributeInformation.FileSystemAttributes & fileSystemAttributesBitUsed) != (uint)fileFsAttributeInformation.FileSystemAttributes));

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR1703,
                    1703,
                    @"[In FILE_FS_ATTRIBUTE_INFORMATION]FileSystemAttributes (4 bytes):  This flag[FILE_FILE_COMPRESSION 0x00000010] is incompatible with the FILE_VOLUME_IS_COMPRESSED flag.");
            }

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1709  MaximumComponentNameLength: {0}",
                fileFsAttributeInformation.MaximumComponentNameLength);
            //
            // Verify requirement 1709
            //
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(Int32),
                fileFsAttributeInformation.MaximumComponentNameLength.GetType(),
                1709,
                @"[In FILE_FS_ATTRIBUTE_INFORMATION]MaximumComponentNameLength (4 bytes):  A 32-bit signed integer that contains the maximum file name component length, in bytes, supported by the specified file system.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1710 Actual MaximumComponentNameLength: {0}",
                fileFsAttributeInformation.MaximumComponentNameLength);
            //
            // Verify requirement 1710
            //
            Site.CaptureRequirementIfIsTrue(
                fileFsAttributeInformation.MaximumComponentNameLength >= 0,
                1710,
                @"[In FILE_FS_ATTRIBUTE_INFORMATION]MaximumComponentNameLength (4 bytes): The value of this field MUST be greater than 0.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1711 Actual FileSystemNameLength: {0}, Expected FileSystemNameLength: {1}.",
                fileFsAttributeInformation.FileSystemNameLength, fileFsAttributeInformation.FileSystemName.Length);
            //
            // Verify requirement 1711
            //
            // Verify the type and the value of the FileSystemNameLength
            bool isVerifyR1711 = (
                fileFsAttributeInformation.FileSystemNameLength.GetType() == typeof(UInt32) &
                fileFsAttributeInformation.FileSystemNameLength == fileFsAttributeInformation.FileSystemName.Length);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1711,
                1711,
                @"[In FILE_FS_ATTRIBUTE_INFORMATION]FileSystemNameLength (4 bytes):  A 32-bit unsigned integer that contains the length, in bytes, of the file system name in the FileSystemName field.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1712");
            //
            // Verify requirement 1712
            //
            Site.CaptureRequirementIfAreEqual<int>(
                fileFsAttributeInformation.FileSystemName.Length,
                (int)fileFsAttributeInformation.FileSystemNameLength,
                1712,
                @"[In FILE_FS_ATTRIBUTE_INFORMATION]FileSystemNameLength (4 bytes):  The value of this field MUST be greater than 0.");

            // As the rs is informative, we capture this rs directly
            Site.CaptureRequirement(
                1713,
                @"[In FILE_FS_ATTRIBUTE_INFORMATION]FileSystemName (variable):
                A variable-length Unicode field containing the name of the file system.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1716 ");

            //
            // Verify requirement 1716
            //
            Site.CaptureRequirementIfAreEqual<int>(
                (int)fileFsAttributeInformation.FileSystemNameLength,
                fileFsAttributeInformation.FileSystemName.Length,
                1716,
                @"[In FILE_FS_ATTRIBUTE_INFORMATION]FileSystemName (variable): This field MUST be handled as a sequence of FileSystemNameLength bytes.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1697 FileSystemAttributes is : {0}",
                fileFsAttributeInformation.FileSystemAttributes );

            //
            // Verify requirement 1697
            //
            // Only get the FILE_VOLUME_IS_COMPRESSED bit in the FileSystemAttributes.
            uint bitBothSet = (uint)(FileSystemAttributes_Values.FILE_FILE_COMPRESSION | FileSystemAttributes_Values.FILE_VOLUME_IS_COMPRESSED);

            bool isVerifyR1697 = (((uint)fileFsAttributeInformation.FileSystemAttributes & bitBothSet) != bitBothSet);
            // Check FILE_VOLUME_IS_COMPRESSED bit and FILE_FILE_COMPRESSION bit are not set at the same time.
            Site.CaptureRequirementIfIsTrue(
                isVerifyR1697,
                1697,
                 @"[In FILE_FS_ATTRIBUTE_INFORMATION]FileSystemAttributes (4 bytes): This flag[FILE_VOLUME_IS_COMPRESSED 0x00008000] is incompatible with the FILE_FILE_COMPRESSION flag.");

            Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"];
        }
        /// <summary>
        /// A utility for test supported features in FileFsAttributeInformation
        /// </summary>
        /// <param name="fileType">An Open of a DataFile or DirectoryFile.</param>
        /// <param name="fileSystemAttribute">FileSystemAttribute to test.</param>
        /// <param name="isSupported">Is true, the FileSystemAttribute will be treated as supported.</param>
        private void FsInfo_Query_FileFsAttributeInformation_IsSupported(FileType fileType, FileSystemAttributes_Values fileSystemAttribute, bool isSupported)
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
            MessageStatus status;

            //Step 1: Create file
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString());
            status = this.fsaAdapter.CreateFile(fileType);

            //Step 2: Query FileFsAttributeInformation
            FileFsAttributeInformation fsAttributeInfo = new FileFsAttributeInformation();

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Query FileFsAttributeInformation");
            status = this.fsaAdapter.QueryFileFsAttributeInformation(out fsAttributeInfo);
            bool actualResult = (fsAttributeInfo.FileSystemAttributes & fileSystemAttribute) == fileSystemAttribute;

            //Step 3: verify test result
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify if FileSystemAttributes flag is correctly set.");
            string feature = fileSystemAttribute.ToString();
            string attribute = string.Format("FileSystemAttributes.{0}", fileSystemAttribute.ToString());

            if (isSupported)
            {
                string comment = string.Format("{0} is supported and {1} MUST be set.", feature, attribute);
                this.fsaAdapter.AssertAreEqual(this.Manager, true, actualResult, comment);
            }
            else
            {
                string comment = string.Format("{0} is NOT supported and {1} MUST NOT be set.", feature, attribute);
                this.fsaAdapter.AssertAreEqual(this.Manager, false, actualResult, comment);
            }
        }