private void AlternateDataStream_Query_FileNetworkOpenInformation(FileType fileType)
        {
            //Prerequisites: Create streams on a newly created file

            //Step 1: Query FILE_NETWORKOPEN_INFORMATION
            long byteCount;
            byte[] outputBuffer;
            FileNetworkOpenInformation fileNetworkOpenInfo = new FileNetworkOpenInformation();
            uint outputBufferSize = (uint)TypeMarshal.ToBytes<FileNetworkOpenInformation>(fileNetworkOpenInfo).Length;

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "{0}. QueryFileInformation with FileInfoClass.FILE_NETWORKOPEN_INFORMATION", ++testStep);
            status = this.fsaAdapter.QueryFileInformation(FileInfoClass.FILE_NETWORKOPEN_INFORMATION, outputBufferSize, out byteCount, out outputBuffer);

            // Step 2: Verify FILE_NETWORKOPEN_INFORMATION
            fileNetworkOpenInfo = TypeMarshal.ToStruct<FileNetworkOpenInformation>(outputBuffer);
            bool isIntegrityStreamSet = (fileNetworkOpenInfo.FileAttributes & (uint)FileAttribute.INTEGRITY_STREAM) == (uint)FileAttribute.INTEGRITY_STREAM;

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "{0}. Verify outputBuffer.FileAttributes.FILE_ATTRIBUTE_INTEGRITY_STREAM", ++testStep);
            if (this.fsaAdapter.IsIntegritySupported == true)
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, true, isIntegrityStreamSet,
                    "If integrity is supported, the object store MUST set FILE_ATTRIBUTE_INTEGRITY_STREAM in OutputBuffer.FileAttributes.");
            }
            else
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, false, isIntegrityStreamSet, "Integrity is not supported, FILE_ATTRIBUTE_INTEGRITY_STREAM MUST NOT set.");
            }
        }
        private void FileInfo_Query_FileNetworkOpenInfo_IsIntegritySupported(FileType fileType)
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
            MessageStatus status;

            //Step 1: Create file
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Create " + fileType.ToString() + " with FileAttribute.INTEGRITY_STREAM");

            status = this.fsaAdapter.CreateFile(
                        FileAttribute.NORMAL | FileAttribute.INTEGRITY_STREAM, // Set Integrity field
                        fileType == FileType.DataFile ? CreateOptions.NON_DIRECTORY_FILE : CreateOptions.DIRECTORY_FILE,
                        fileType == FileType.DataFile ? StreamTypeNameToOPen.DATA : StreamTypeNameToOPen.INDEX_ALLOCATION, //Stream Type
                        FileAccess.GENERIC_READ | FileAccess.GENERIC_WRITE | FileAccess.FILE_WRITE_DATA | FileAccess.FILE_WRITE_ATTRIBUTES,
                        ShareAccess.FILE_SHARE_READ | ShareAccess.FILE_SHARE_WRITE,
                        CreateDisposition.OPEN_IF,
                        StreamFoundType.StreamIsFound,
                        SymbolicLinkType.IsNotSymbolicLink,
                        fileType,
                        FileNameStatus.PathNameValid);

            //Step 2: Query FILE_NETWORKOPEN_INFORMATION
            long byteCount;
            byte[] outputBuffer;
            FileNetworkOpenInformation fileNetworkOpenInfo = new FileNetworkOpenInformation();
            uint outputBufferSize = (uint)TypeMarshal.ToBytes<FileNetworkOpenInformation>(fileNetworkOpenInfo).Length;

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. QueryFileInformation with FileInfoClass.FILE_NETWORKOPEN_INFORMATION");
            status = this.fsaAdapter.QueryFileInformation(FileInfoClass.FILE_NETWORKOPEN_INFORMATION, outputBufferSize, out byteCount, out outputBuffer);

            //Step 3: Verify test result
            fileNetworkOpenInfo = TypeMarshal.ToStruct<FileNetworkOpenInformation>(outputBuffer);
            bool isIntegrityStreamSet = (fileNetworkOpenInfo.FileAttributes & (uint)FileAttribute.INTEGRITY_STREAM) == (uint)FileAttribute.INTEGRITY_STREAM;

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify outputBuffer.FileAttributes.FILE_ATTRIBUTE_INTEGRITY_STREAM");
            if (this.fsaAdapter.IsIntegritySupported == true)
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, true, isIntegrityStreamSet,
                    "If integrity is supported, the object store MUST set FILE_ATTRIBUTE_INTEGRITY_STREAM in OutputBuffer.FileAttributes.");
            }
            else
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, false, isIntegrityStreamSet, "Integrity is not supported, FILE_ATTRIBUTE_INTEGRITY_STREAM MUST NOT set.");
            }
        }
        /// <summary>
        /// Verify data type FileNetworkOpenInformation
        /// </summary>
        /// <param name="fileNetworkOpenInformation"> FileNetworkOpenInformation data type </param>
        /// <param name="allocationSize"> A 64-bit signed integer that contains the file allocation size in bytes. </param>
        /// <param name="fileAttributes"> A 32-bit unsigned integer that contains the file attributes. </param>
        public void VerifyDataTypeFileNetworkOpenInformation(
            FileNetworkOpenInformation fileNetworkOpenInformation,
            int allocationSize,
            uint fileAttributes)
        {
            Site.DefaultProtocolDocShortName = "MS-FSCC";
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1434 Actual CreationTime: {0}",
                fileNetworkOpenInformation.CreationTime.ToString());
            //
            // Verify requirement 1434
            //
            // Verify the type and the value of the CreationTime
            int sizeOfCreationTime = 8;

            bool isVerifyR1434 = (
                Marshal.SizeOf(fileNetworkOpenInformation.CreationTime) == sizeOfCreationTime &&
                fileNetworkOpenInformation.CreationTime.GetType() == typeof(Microsoft.Protocols.TestTools.StackSdk.FileAccessService.Fscc.FILETIME));

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1434,
                1434,
                @"[In FILE_NETWORK_OPEN_INFORMATION]CreationTime (8 bytes):
                A 64-bit signed integer that contains the time when the file was created in the format of
                a FILETIME structure.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1435 Actual CreationTime: {0}",
                fileNetworkOpenInformation.CreationTime.ToString());
            //
            // Verify requirement 1435
            //
            // Verify CreationTime >= 0
            // As the type and the value is verified above, we didn't verify here again
            bool isVerifyR1435 = (
                fileNetworkOpenInformation.CreationTime.dwHighDateTime >= 0 &&
                fileNetworkOpenInformation.CreationTime.dwLowDateTime >= 0);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1435,
                1435,
                @"[In FILE_NETWORK_OPEN_INFORMATION]CreationTime (8 bytes):
                The value of this field MUST be greater than or equal to 0.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1436 Actual LastAccessTime: {0}",
                fileNetworkOpenInformation.LastAccessTime.ToString());
            //
            // Verify requirement 1436
            //
            // Verify the type and the value of the LastAccessTime
            int sizeOfLastAccessTime = 8;
            bool isVerifyR1436 = (
                Marshal.SizeOf(fileNetworkOpenInformation.LastAccessTime) == sizeOfLastAccessTime &&
                fileNetworkOpenInformation.LastAccessTime.GetType() == typeof(Microsoft.Protocols.TestTools.StackSdk.FileAccessService.Fscc.FILETIME));

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1436,
                1436,
                @"[In FILE_NETWORK_OPEN_INFORMATION]LastAccessTime (8 bytes):  A 64-bit signed integer that contains
                the last time the file was accessed in the format of a FILETIME structure.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1437 Actual LastAccessTime: {0}",
                fileNetworkOpenInformation.LastAccessTime.ToString());

            //
            // Verify requirement 1437
            //
            // Verify LastAccessTime >= 0
            // As the type and the value of the LastAccessTime is Verified above, we didn't verify here again
            bool isVerifyR1437 = (
                fileNetworkOpenInformation.LastAccessTime.dwHighDateTime >= 0 &&
                fileNetworkOpenInformation.LastAccessTime.dwLowDateTime >= 0);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1437,
                1437,
                @"[In FILE_NETWORK_OPEN_INFORMATION]LastAccessTime (8 bytes):
                The value of this field MUST be greater than or equal to 0.");

            //
            // Verify requirement 1438
            //

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1438 Actual LastWriteTime: {0}",
                fileNetworkOpenInformation.LastWriteTime.ToString());

            // Verify the type and the value of the LastWriteTime
            int sizeOfLastWriteTime = 8;

            bool isVerifyR1438 = (
                Marshal.SizeOf(fileNetworkOpenInformation.LastWriteTime) == sizeOfLastWriteTime &&
                fileNetworkOpenInformation.LastWriteTime.GetType() == typeof(Microsoft.Protocols.TestTools.StackSdk.FileAccessService.Fscc.FILETIME));

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1438,
                1438,
                @"[In FILE_NETWORK_OPEN_INFORMATION]LastWriteTime (8 bytes):
                A 64-bit signed integer that contains the last time information was written to the file in the
                format of a FILETIME structure.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1439 Actual LastWriteTime: {0}",
                fileNetworkOpenInformation.LastWriteTime.ToString());
            //
            // Verify requirement 1439
            //
            // Verify LastWriteTime >= 0
            // As the type and the value of the LastWriteTime is verified above, we didn't verify here again

            bool isVerifyR1439 = (
                fileNetworkOpenInformation.LastWriteTime.dwHighDateTime >= 0 &&
                fileNetworkOpenInformation.LastWriteTime.dwLowDateTime >= 0);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1439,
                1439,
                @"[In FILE_NETWORK_OPEN_INFORMATION]LastWriteTime (8 bytes):
                The value of this field MUST be greater than or equal to 0.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1440 Actual ChangeTime: {0}",
                fileNetworkOpenInformation.ChangeTime.ToString());

            //
            // Verify requirement 1440
            //
            // Verify the type and the value of the ChangeTime
            int sizeOfChangeTime = 8;

            bool isVerifyR1440 = (
                Marshal.SizeOf(fileNetworkOpenInformation.ChangeTime) == sizeOfChangeTime &&
                fileNetworkOpenInformation.ChangeTime.GetType() == typeof(Microsoft.Protocols.TestTools.StackSdk.FileAccessService.Fscc.FILETIME));

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1440,
                1440,
                @"[In FILE_NETWORK_OPEN_INFORMATION]ChangeTime (8 bytes):
                A 64-bit signed integer that contains the last time the file was changed in the format of
                a FILETIME structure.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1441 Actual ChangeTime: {0}",
                fileNetworkOpenInformation.ChangeTime.ToString());
            //
            // Verify requirement 1441
            //
            // Verify the ChangeTime >= 0
            // As the type and the value of the changeTime is verified above, we didn't verify here again
            bool isVerified_r1441 = (
                fileNetworkOpenInformation.ChangeTime.dwHighDateTime >= 0 &&
                fileNetworkOpenInformation.ChangeTime.dwLowDateTime >= 0);

            Site.CaptureRequirementIfIsTrue(
                isVerified_r1441,
                1441,
                @"[In FILE_NETWORK_OPEN_INFORMATION]ChangeTime (8 bytes):
                The value of this field MUST be greater than or equal to 0.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1444 Actual AllocationSize: {0}, Expected AllocationSize: {1}.",
                fileNetworkOpenInformation.AllocationSize, allocationSize);

            //
            // Verify requirement 1444
            //
            // As the type and the value of the AllocationSize is verified above, we didn't verify here again
            Site.CaptureRequirementIfIsTrue(
                fileNetworkOpenInformation.AllocationSize >= 0,
                1444,
                @"[In FILE_NETWORK_OPEN_INFORMATION]AllocationSize (8 bytes):
                The value of this field MUST be greater than or equal to 0.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1445 EndOfFile: {0}.",
                fileNetworkOpenInformation.EndOfFile);
            //
            // Verify requirement 1445
            //
            // As it's unenable for us to verify the EndOfFile, what we only can do is just verifying the
            // offset is in the range of the AllocationSize
            bool isVerifyR1445 = (
                fileNetworkOpenInformation.EndOfFile.GetType() == typeof(Int64) &&
                fileNetworkOpenInformation.EndOfFile <= fileNetworkOpenInformation.AllocationSize);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1445,
                1445,
                @"[In FILE_NETWORK_OPEN_INFORMATION]EndOfFile (8 bytes):
                 A 64-bit signed integer that contains the absolute new end-of-file position as a byte offset
                 from the start of the file.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "MS-FSCC_R1446, EndOfFile is : {0}",
                fileNetworkOpenInformation.EndOfFile);
            //
            // Verify requirement 1446
            //
            // As we parse the file by using the endoFile, it's useless for us to verify if this value valid again
            // Verify the size for this rs
            const int sizeOfEndOfFile = 8;
            Site.CaptureRequirementIfAreEqual<int>(
                sizeOfEndOfFile,
                Marshal.SizeOf(fileNetworkOpenInformation.EndOfFile),
                1446,
                @"[In FILE_NETWORK_OPEN_INFORMATION]EndOfFile (8 bytes): EndOfFile specifies the offset to the byte
                immediately following the last valid byte in the file.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "MS-FSCC_R1447, EndOfFile: {0}",
                fileNetworkOpenInformation.EndOfFile);
            //
            // Verify requirement 1447
            //
            // As we parse the file by using the endoFile, it's useless for us to verify if this value valid again
            // Verify the size for this rs
            Site.CaptureRequirementIfAreEqual<int>(
                sizeOfEndOfFile,
                Marshal.SizeOf(fileNetworkOpenInformation.EndOfFile),
                1447,
                @"[In FILE_NETWORK_OPEN_INFORMATION]EndOfFile (8 bytes): Because this value is zero-based, it
                actually refers to the first free byte in the file. That is, it is the offset from the beginning of
                the file at which new bytes appended to the file will be written.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "MS-FSCC ReqId: {0}", 1450);

            const int sizeOfFileAttributes = 4;
            //
            // Verify requirement 1450
            //
            // Verify the size and the value of FileAttributes, and the values are:
            // FILE_ATTRIBUTE_ARCHIVE 0x00000020, FILE_ATTRIBUTE_COMPRESSED 0x00000800,
            // FILE_ATTRIBUTE_DIRECTORY 0x00000010, FILE_ATTRIBUTE_ENCRYPTED 0x00004000,
            // FILE_ATTRIBUTE_HIDDEN 0x00000002, FILE_ATTRIBUTE_NORMAL 0x00000080,
            // FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000, FILE_ATTRIBUTE_OFFLINE 0x00001000,
            // FILE_ATTRIBUTE_READONLY 0x00000001, FILE_ATTRIBUTE_REPARSE_POINT 0x00000400,
            // FILE_ATTRIBUTE_SPARSE_FILE 0x00000200, FILE_ATTRIBUTE_SYSTEM 0x00000004,
            // FILE_ATTRIBUTE_TEMPORARY 0x00000100]
            uint bitUsed = (
                0x00000020 | 0x00000800 | 0x00000010 | 0x00004000 |
                0x00000002 | 0x00000080 | 0x00002000 | 0x00001000 |
                0x00000001 | 0x00000400 | 0x00000200 | 0x00000004 | 0x00000100);

            // Get the bits which the file attributes not used
            uint bitUnused = ~bitUsed;
            bool isVerufyR1450 =  (((sizeOfFileAttributes == Marshal.SizeOf(fileNetworkOpenInformation.FileAttributes)) &&
                (bitUnused & fileNetworkOpenInformation.FileAttributes) == 0x00000000));

            Site.CaptureRequirementIfIsTrue(
                isVerufyR1450,
                1450,
                @"[In FILE_NETWORK_OPEN_INFORMATION]FileAttributes (4 bytes): Valid attributes are as specified in
                section 2.6.");

            //
            // Verify requirement 1452
            //

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "MS-FSCC_R1452 ,Reserved is : {0} ",
                fileNetworkOpenInformation.Reserved);

            // As the reserved field is reserved, and the value can be any value
            // This rs will be captured directly after verify the size of reserved
            const int sizeOfReserved = 4;
            Site.CaptureRequirementIfAreEqual<int>(
                sizeOfReserved,
                Marshal.SizeOf(fileNetworkOpenInformation.Reserved),
                1452,
                @"[In FILE_NETWORK_OPEN_INFORMATION]Reserved (4 bytes): This field is reserved.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1448 EndOfFile: {0}.",
                fileNetworkOpenInformation.EndOfFile);
            //
            // Verify requirement 1448
            //
            Site.CaptureRequirementIfIsTrue(
                fileNetworkOpenInformation.EndOfFile >= 0,
                1448,
                @"[In FILE_NETWORK_OPEN_INFORMATION]EndOfFile (8 bytes): The value of this field
                MUST be greater than or equal to 0.");
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1449 Actual FileAttributes: {0}, Expected FileAttributes: {1}.",
                fileNetworkOpenInformation.FileAttributes, fileAttributes);
            //
            // Verify requirement 1449
            //
            // Verify the type and the value of the fileAttributes
            bool isVerifyR1449 = (fileNetworkOpenInformation.FileAttributes.GetType() == typeof(UInt32) &&
                                    fileNetworkOpenInformation.FileAttributes == fileAttributes);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1449,
                1449,
                @"[In FILE_NETWORK_OPEN_INFORMATION]FileAttributes (4 bytes):
                A 32-bit unsigned integer that contains the file attributes.");

            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1451 Actual Reserved is: {0}",
                fileNetworkOpenInformation.Reserved);
            //
            // Verify requirement 1451
            //
            Site.CaptureRequirementIfAreEqual<int>(
                sizeOfReserved,
                Marshal.SizeOf(fileNetworkOpenInformation.Reserved),
                1451,
                @"[In FILE_NETWORK_OPEN_INFORMATION]Reserved (4 bytes):  A 32-bit field.");
            //
            // Add the debug information
            //
               Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1453 Actual Reserved: {0}.",
                fileNetworkOpenInformation.Reserved);
            //
            // Verify requirement 1453
            //
            Site.CaptureRequirementIfAreEqual<int>(
                sizeOfReserved,
                Marshal.SizeOf(fileNetworkOpenInformation.Reserved),
                1453,
                @"[In FILE_NETWORK_OPEN_INFORMATION]Reserved (4 bytes): This field can be set to any value.");

            // As all the elements in the FILE_NETWORK_OPEN_INFORMATION have been verified above
            // This rs will be captured directly
            Site.CaptureRequirement(
                1433,
                @"[In FileNetworkOpenInformation]The FILE_NETWORK_OPEN_INFORMATION data element is as follows:
                [CreationTime, ..., LastAccessTime, ..., LastWriteTime, ..., ChangeTime, ..., AllocationSize, ...,
                EndOfFile, ..., FileAttributes, Reserved].");

            Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"];
        }