private void FileInfo_Query_FileFullEaInformation_IsEASupported(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());
            status = this.fsaAdapter.CreateFile(fileType);

            //Step 2: Set FILE_FULLEA_INFORMATION
            string eaName = this.fsaAdapter.ComposeRandomFileName(8);
            string eaValue = this.fsaAdapter.ComposeRandomFileName(8);
            FileFullEaInformation fileFullEaInfo = new FileFullEaInformation();
            fileFullEaInfo.NextEntryOffset = 0;
            fileFullEaInfo.Flags = FILE_FULL_EA_INFORMATION_FLAGS.NONE;
            fileFullEaInfo.EaNameLength = (byte)eaName.Length;
            fileFullEaInfo.EaValueLength = (ushort)eaValue.Length;
            fileFullEaInfo.EaName = Encoding.ASCII.GetBytes(eaName + "\0");
            fileFullEaInfo.EaValue = Encoding.ASCII.GetBytes(eaValue);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. SetFileInformation with FileInfoClass.FILE_FULLEA_INFORMATION.");
            status = this.fsaAdapter.SetFileFullEaInformation(fileFullEaInfo);

            //Step 3: Query FILE_FULLEA_INFORMATION
            long byteCount;
            byte[] outputBuffer;
            uint outputBufferSize = (uint)TypeMarshal.ToBytes<FileFullEaInformation>(fileFullEaInfo).Length;

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

            //Step 4: Verify test result
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "4. Verify returned NTSTATUS code.");
            if (this.fsaAdapter.Transport == Transport.SMB)
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status,
                    "STATUS_SUCCESS when one or more entries were returned from Open.File.ExtendedAttributes and there are no more entries to return.");
                return;
            }
            if (this.fsaAdapter.IsExtendedAttributeSupported == false)
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_DEVICE_REQUEST, status,
                    "If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.");
            }
            else
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status,
                    "STATUS_SUCCESS when one or more entries were returned from Open.File.ExtendedAttributes and there are no more entries to return.");
            }
        }
        private void FileInfo_Query_FileEaInformation_IsEASupported(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());
            status = this.fsaAdapter.CreateFile(fileType);

            //Step 2: Set FILE_FULLEA_INFORMATION
            string eaName = this.fsaAdapter.ComposeRandomFileName(8);
            string eaValue = this.fsaAdapter.ComposeRandomFileName(8);
            FileFullEaInformation fileFullEaInfo = new FileFullEaInformation();
            fileFullEaInfo.NextEntryOffset = 0;
            fileFullEaInfo.Flags = FILE_FULL_EA_INFORMATION_FLAGS.NONE;
            fileFullEaInfo.EaNameLength = (byte)eaName.Length;
            fileFullEaInfo.EaValueLength = (ushort)eaValue.Length;
            fileFullEaInfo.EaName = Encoding.ASCII.GetBytes(eaName + "\0");
            fileFullEaInfo.EaValue = Encoding.ASCII.GetBytes(eaValue);

            byte[] inputBuffer = TypeMarshal.ToBytes<FileFullEaInformation>(fileFullEaInfo);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. SetFileInformation with FileInfoClass.FILE_FULLEA_INFORMATION.");
            status = this.fsaAdapter.SetFileFullEaInformation(fileFullEaInfo);

            //Step 3: Query FILE_EA_INFORMATION
            long byteCount;
            byte[] outputBuffer;

            FileEaInformation fileEaInfo = new FileEaInformation();
            uint outputBufferSize = (uint)TypeMarshal.ToBytes<FileEaInformation>(fileEaInfo).Length;

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

            //Step 4: Verify test result
            fileEaInfo = TypeMarshal.ToStruct<FileEaInformation>(outputBuffer);
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "4. Verify outputBuffer.EaSize");
            if (this.fsaAdapter.IsExtendedAttributeSupported == false)
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, (uint)0, fileEaInfo.EaSize,
                    "ExtendedAttribute is not supported, OutputBuffer.EaSize should be 0.");
            }
            else
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, true, fileEaInfo.EaSize > 0,
                    "ExtendedAttribute is supported, OutputBuffer.EaSize should be greater than 0.");
            }
        }
        private void FileInfo_Set_FileFullEaInformation_IsEASupported(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());
            status = this.fsaAdapter.CreateFile(fileType);

            //Step 2: Set FILE_FULLEA_INFORMATION
            string eaName = this.fsaAdapter.ComposeRandomFileName(8);
            string eaValue = this.fsaAdapter.ComposeRandomFileName(8);
            FileFullEaInformation fileFullEaInfo = new FileFullEaInformation();
            fileFullEaInfo.NextEntryOffset = 0;
            fileFullEaInfo.Flags = FILE_FULL_EA_INFORMATION_FLAGS.NONE;
            fileFullEaInfo.EaNameLength = (byte)eaName.Length;
            fileFullEaInfo.EaValueLength = (ushort)eaValue.Length;
            fileFullEaInfo.EaName = Encoding.ASCII.GetBytes(eaName + "\0");
            fileFullEaInfo.EaValue = Encoding.ASCII.GetBytes(eaValue);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. SetFileInformation with FileInfoClass.FILE_FULLEA_INFORMATION.");
            status = this.fsaAdapter.SetFileFullEaInformation(fileFullEaInfo);

            //Step 3: Verify test result
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify returned NTSTATUS code.");
            if (this.fsaAdapter.IsExtendedAttributeSupported == false)
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_DEVICE_REQUEST, status,
                    "[MS-FSA] Undocumented error code STATUS_INVALID_DEVICE_REQUEST for query FileFullEaInformation in unsupported file system " + this.fsaAdapter.FileSystem.ToString());
            }
            else
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status,
                    "STATUS_SUCCESS when one or more entries were returned from Open.File.ExtendedAttributes and there are no more entries to return.");
            }
        }
        /// <summary>
        /// Verify the message syntax in FILE_FULL_EA_INFORMATION
        /// </summary>
        /// <param name="fileFullEaInformation">A FileFullEaInformation type structure.</param>
        /// <param name="sizeOfCurrEntry">The size of the current entry.</param>
        /// <param name="extendedAttributeName"> the extended attribute name followed by a single null-termination character byte.</param>
        /// <param name="extendedAttributeValue">The extended attrubute value.</param>
        /// <param name="sizeOfByteOffset">the byte offset from the beginning of this entry, at which the next FILE_ FULL_EA _INFORMATION entry is located, if multiple entries are present in the buffer.</param>
        /// <param name="areMultipleEntriesPresent">A bool variable that means multiple entries are present in the buffer.</param>
        /// <param name="isNextEntryLocated">A bool variable that means the next FILE_ FULL_EA _INFORMATION entry is located</param>
        public void VerifyMessageSyntaxFileFullEaInformation(
            FileFullEaInformation fileFullEaInformation,
            uint sizeOfCurrEntry,
            string extendedAttributeName,
            string extendedAttributeValue,
            uint sizeOfByteOffset,
            bool areMultipleEntriesPresent,
            bool isNextEntryLocated)
        {
            Site.DefaultProtocolDocShortName = "MS-FSCC";
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1206,the value of EaName is {0}", fileFullEaInformation.EaName);

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1206
            //
            // Not verify ASCII characters
            bool isVerifyR1206 = (fileFullEaInformation.EaName.ToString().Contains(extendedAttributeName));

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1206,
                1206,
                @"[In FILE_FULL_EA_INFORMATION]EaName (variable):  An array of 8-bit ASCII characters that contains the extended attribute name followed by a single null-termination character byte.");

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

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1207
            //
            bool isVerifyR1207 = (fileFullEaInformation.EaValue.ToString().Contains(extendedAttributeValue));

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1207,
                1207,
                @"[In FILE_FULL_EA_INFORMATION]EaValue (variable):  An array of bytes that contains the extended attribute value.");

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

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1203
            //
            bool isVerifyR1203 =
                (Marshal.SizeOf(fileFullEaInformation.EaNameLength) == 1) &&
                (fileFullEaInformation.EaNameLength == fileFullEaInformation.EaName.Length);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1203,
                1203,
                @"[In FILE_FULL_EA_INFORMATION]EaNameLength (1 byte):  An 8-bit unsigned integer that contains the length, in bytes, of the extended attribute name in the EaName field.");

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

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1205
            //
            bool isVerifyR1205 =
                (Marshal.SizeOf(fileFullEaInformation.EaValueLength) == 2) &&
                (fileFullEaInformation.EaValueLength == fileFullEaInformation.EaValue.Length);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1205,
                1205,
                @"[In FILE_FULL_EA_INFORMATION]EaValueLength (2 bytes):  A 16-bit unsigned integer that contains the length, in bytes, of the extended attribute value in the EaValue field.");

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

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1200
            //
            // From definition of Flags_Values, V1 equals 0.
            bool isVerifyR1200 =
                (Marshal.SizeOf(fileFullEaInformation.Flags) == 1) &&
                (fileFullEaInformation.Flags == FILE_FULL_EA_INFORMATION_FLAGS.FILE_NEED_EA ||
                fileFullEaInformation.Flags == FILE_FULL_EA_INFORMATION_FLAGS.NONE);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1200,
                1200,
                @"[In FILE_FULL_EA_INFORMATION]Flags (1 byte):  An 8-bit unsigned integer that contains one of the following flag values:[0x00000000, FILE_NEED_EA 0x00000080].");

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

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1199
            //
            Site.CaptureRequirementIfAreNotSame(
                sizeOfCurrEntry,
                fileFullEaInformation.NextEntryOffset,
                1199,
                @"[In FILE_FULL_EA_INFORMATION]NextEntryOffset (4 bytes):  An implementation MUST NOT assume that the value of NextEntryOffset field is the same as the size of the current entry.");

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

            // Check if multiple entries are present in the buffer
            if (areMultipleEntriesPresent)
            {
                //
                // Verify MS-FSCC requirement: MS-FSCC_R1196
                //
                bool isVerifyR1196 =
                    (Marshal.SizeOf(fileFullEaInformation.NextEntryOffset) == 4) &&
                    (fileFullEaInformation.NextEntryOffset == sizeOfByteOffset) &&
                    (isNextEntryLocated);

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR1196,
                    1196,
                    @"[In FILE_FULL_EA_INFORMATION]NextEntryOffset (4 bytes):  A 32-bit unsigned 4-byte aligned integer that contains the byte offset from the beginning of this entry, at which the next FILE_ FULL_EA _INFORMATION entry is located, if multiple entries are present in the buffer.");
            }
            // if just one entry is present in the buffer
            else if (!areMultipleEntriesPresent)
            {
                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1196,the value of NextEntryOffset is {0}", fileFullEaInformation.NextEntryOffset);

                //
                // Verify MS-FSCC requirement: MS-FSCC_R1196
                //
                bool isVerifyR1196 =
                    (Marshal.SizeOf(fileFullEaInformation.NextEntryOffset) == 4) &&
                    (fileFullEaInformation.NextEntryOffset == sizeOfByteOffset);

                Site.CaptureRequirementIfIsTrue(
                    isVerifyR1196,
                    1196,
                    @"[In FILE_FULL_EA_INFORMATION]NextEntryOffset (4 bytes):  A 32-bit unsigned 4-byte aligned integer that contains the byte offset from the beginning of this entry, at which the next FILE_ FULL_EA _INFORMATION entry is located, if multiple entries are present in the buffer.");
            }

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