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 AlternateDataStream_Set_FileEaInformation(FileType fileType)
        {
            //Prerequisites: Create streams on a newly created file

            //Step 1: Set FILE_EA_INFORMATION
            FileEaInformation fileEaInfo = new FileEaInformation();
            fileEaInfo.EaSize = 1024;
            byte[] inputBuffer = TypeMarshal.ToBytes<FileEaInformation>(fileEaInfo);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "{0}. SetFileInformation with FileInfoClass.FILE_EA_INFORMATION.", ++testStep);
            status = this.fsaAdapter.SetFileInformation(FileInfoClass.FILE_EA_INFORMATION, inputBuffer);

            //Step 2: Verify test result
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "{0}. Verify returned NTSTATUS code.", ++testStep);
            this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_INFO_CLASS, status,
                "This operation is not supported and MUST be failed with STATUS_ INVALID_INFO_CLASS.");
        }
        private void FileInfo_Set_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.DataFile);

            //Step 2: Set FILE_EA_INFORMATION
            FileEaInformation fileEaInfo = new FileEaInformation();
            fileEaInfo.EaSize = 1024;
            byte[] inputBuffer = TypeMarshal.ToBytes<FileEaInformation>(fileEaInfo);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. SetFileInformation with FileInfoClass.FILE_EA_INFORMATION.");
            status = this.fsaAdapter.SetFileInformation(FileInfoClass.FILE_EA_INFORMATION, inputBuffer);

            //Step 3: Verify test result
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify returned NTSTATUS code.");
            this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.INVALID_INFO_CLASS, status,
                "This operation is not supported and MUST be failed with STATUS_ INVALID_INFO_CLASS.");
        }
        /// <summary>
        /// Verify the data type FileEaInformation in TD 2.4.12
        /// </summary>
        /// <param name="fileEaInformation"> FileEaInformation type data </param>
        /// <param name="EAlength"> Length of extended attributes (EA) for the file (in bytes) </param>
        public void VerifyDataTypeFileEaInformation(
            FileEaInformation fileEaInformation,
            uint EAlength)
        {
            Site.DefaultProtocolDocShortName = "MS-FSCC";
            //
            // Add the debugging information
            //
            Site.Log.Add(LogEntryKind.Debug,
                "Verify MS-FSCC_R1157, Actual EaSize: {0}, Expected EaLength: {1};",
                fileEaInformation.EaSize, EAlength);
            //
            // Verify MS-FSCC requirement 1157
            //
            // verfiy the type of the EaSize and the content.
            bool isVerifyR1157 = (fileEaInformation.EaSize.GetType() == typeof(UInt32) &&
                                     fileEaInformation.EaSize == EAlength);

            Site.CaptureRequirementIfIsTrue(
                isVerifyR1157,
                1157,
                @"[In FILE_EA_INFORMATION]EaSize (4 bytes):  A 32-bit unsigned integer that contains the
                combined length, in bytes, of the extended attributes (EA) for the file.");
            // FILE_EA_INFORMATION has been definned as section 2.4.12.
            // As the rs in section 2.4.12 are verified
            // Verify type of the EaInformation specified in section 2.4.12
            Site.CaptureRequirement(
                981,
                @"[In FileAllInformation]EaInformation (4 bytes):
                A FILE_EA_INFORMATION structure specified in section 2.4.12.");

            // As all the elements in the FILE_EA_INFORMATION have been verified above
            // This rs will be captured directly
            Site.CaptureRequirement(
                1156,
                @"[In FileEaInformation]The FILE_EA_INFORMATION data element is as follows:[EaSize].");

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