private void FsInfo_Set_FileFsSectorSizeInformation_InvalidInfoClass(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_FsSectorSizeInformation
            FILE_FS_SECTOR_SIZE_INFORMATION fileFsSectorSizeInfo = new FILE_FS_SECTOR_SIZE_INFORMATION();
            byte[] inputBuffer = TypeMarshal.ToBytes<FILE_FS_SECTOR_SIZE_INFORMATION>(fileFsSectorSizeInfo);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Set File_FsSectorSizeInformation.");
            status = this.fsaAdapter.SetFileSystemInformation((uint)FileSystemInfoClass.File_FsSectorSizeInformation, 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.");
        }
        private void FsInfo_Query_FileFsSectorSizeInformation_OutputBufferSizeEqualToSectorSizeInfo(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: Query File_FsSectorSizeInformation
            long byteCount;
            byte[] outputBuffer = new byte[0];
            FILE_FS_SECTOR_SIZE_INFORMATION fileFsSectorSizeInfo = new FILE_FS_SECTOR_SIZE_INFORMATION();

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Query File_FsSectorSizeInformation.");
            BaseTestSite.Log.Add(LogEntryKind.Debug, "Parameter: OutputBufferSize equals to sizeof(FILE_FS_SECTOR_SIZE_INFORMATION).");
            uint outputBufferSize = (uint)TypeMarshal.ToBytes<FILE_FS_SECTOR_SIZE_INFORMATION>(fileFsSectorSizeInfo).Length;

            status = this.fsaAdapter.QueryFileSystemInformation(FileSystemInfoClass.File_FsSectorSizeInformation, outputBufferSize, out byteCount, out outputBuffer);

            //Step 3: Verify test result
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Verify returned NTStatus code.");
            this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status, "Expected result: Status set to STATUS_SUCCESS.");
        }
        private void FsInfo_Query_FileFsSectorSizeInformation_OutputValue_Common(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: Query File_FsSectorSizeInformation
            FILE_FS_SECTOR_SIZE_INFORMATION fileFsSectorSizeInfo = new FILE_FS_SECTOR_SIZE_INFORMATION();
            uint outputBufferSize = (uint)TypeMarshal.ToBytes<FILE_FS_SECTOR_SIZE_INFORMATION>(fileFsSectorSizeInfo).Length;
            long byteCount;
            byte[] OutputBuffer = new byte[0];

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Query File_FsSectorSizeInformation.");
            status = this.fsaAdapter.QueryFileSystemInformation(FileSystemInfoClass.File_FsSectorSizeInformation, outputBufferSize, out byteCount, out OutputBuffer);

            //Step 3: Print some output values
            fileFsSectorSizeInfo = TypeMarshal.ToStruct<FILE_FS_SECTOR_SIZE_INFORMATION>(OutputBuffer);
            uint systemPageSize = (this.fsaAdapter.SystemPageSizeInKB * 1024);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Print some output values");
            BaseTestSite.Log.Add(LogEntryKind.Debug, "SystemPageSize: " + systemPageSize);
            BaseTestSite.Log.Add(LogEntryKind.Debug, "LogicalBytesPerSector: " + fileFsSectorSizeInfo.LogicalBytesPerSector);
            BaseTestSite.Log.Add(LogEntryKind.Debug, "PhysicalBytesPerSectorForAtomicity: " + fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity);
            BaseTestSite.Log.Add(LogEntryKind.Debug, "PhysicalBytesPerSectorForPerformance: " + fileFsSectorSizeInfo.PhysicalBytesPerSectorForPerformance);
            BaseTestSite.Log.Add(LogEntryKind.Debug, "FileSystemEffectivePhysicalBytesPerSectorForAtomicity: " + fileFsSectorSizeInfo.FileSystemEffectivePhysicalBytesPerSectorForAtomicity);

            //Step 4: Verify test result
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Verify server response.");
            //4.1. Verify LogicalBytesPerSector
            BaseTestSite.Log.Add(LogEntryKind.Comment, "----------------------------");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "4.1. Verify LogicalBytesPerSector.");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "OutputBuffer.LogicalBytesPerSector set to Open.Volume.LogicalBytesPerSector.");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "LogicalBytesPerSector MUST be a power of two and MUST be greater than or equal to 512 and less than or equal to Volume.SystemPageSize.");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "According to above info, LogicalBytesPerSector will be set as following:");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, FsaUtility.IsPowerOfTwo(fileFsSectorSizeInfo.LogicalBytesPerSector), "It MUST be a power of two.");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, fileFsSectorSizeInfo.LogicalBytesPerSector >= 512, "It MUST be greater than or equal to 512.");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, fileFsSectorSizeInfo.LogicalBytesPerSector <= systemPageSize, "It MUST be less than or equal to Volume.SystemPageSize.");

            //4.2. Verify PhysicalBytesPerSectorForAtomicity
            BaseTestSite.Log.Add(LogEntryKind.Comment, "----------------------------");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "4.2. Verify PhysicalBytesPerSectorForAtomicity.");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "Set OutputBuffer.PhysicalBytesPerSectorForAtomicity to the physical sector size reported from the storage device underlying the object store.");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "PhysicalBytesPerSector MUST be a power of two, MUST be greater than or equal to 512 and less than or equal to Volume.SystemPageSize, and MUST be greater than or equal to Volume.LogicalBytesPerSector. ");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "According to above info, PhysicalBytesPerSectorForAtomicity will be set as following:");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, FsaUtility.IsPowerOfTwo(fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity), "It MUST be a power of two.");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity >= 512, "It MUST be greater than or equal to 512.");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity <= systemPageSize, "It MUST be less than or equal to Volume.SystemPageSize.");
            this.fsaAdapter.AssertAreEqual(this.Manager, true, fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity >= fileFsSectorSizeInfo.LogicalBytesPerSector, "It MUST be greater than or equal to Volume.LogicalBytesPerSector.");

            //4.3. Verify PhysicalBytesPerSectorForPerformance
            BaseTestSite.Log.Add(LogEntryKind.Comment, "----------------------------");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "4.3. Verify PhysicalBytesPerSectorForPerformance.");
            this.fsaAdapter.AssertAreEqual(this.Manager, fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity, fileFsSectorSizeInfo.PhysicalBytesPerSectorForPerformance,
                "OutputBuffer.PhysicalBytesPerSectorForPerformance is set to OutputBuffer.PhysicalBytesPerSectorForAtomicity.");

            //4.4. Verify FileSystemEffectivePhysicalBytesPerSectorForAtomicity
            BaseTestSite.Log.Add(LogEntryKind.Comment, "----------------------------");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "4.4. Verify FileSystemEffectivePhysicalBytesPerSectorForAtomicity.");
            BaseTestSite.Log.Add(LogEntryKind.Comment, "PhysicalBytesPerSectorForAtomicity: " + fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity);

            if (fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity > systemPageSize)
            {
                BaseTestSite.Log.Add(LogEntryKind.Comment, "If OutputBuffer.PhysicalBytesPerSectorForAtomicity is greater than Open.Volume.SystemPageSize:");
                BaseTestSite.Log.Add(LogEntryKind.Comment, "Set OutputBuffer.FileSystemEffectivePhysicalBytesPerSectorForAtomicity to Open.Volume.SystemPageSize.");
                this.fsaAdapter.AssertAreEqual(this.Manager, systemPageSize, fileFsSectorSizeInfo.FileSystemEffectivePhysicalBytesPerSectorForAtomicity,"");
            }
            else
            {
                BaseTestSite.Log.Add(LogEntryKind.Comment, "If OutputBuffer.PhysicalBytesPerSectorForAtomicity is less than or equal to Open.Volume.SystemPageSize:");
                BaseTestSite.Log.Add(LogEntryKind.Comment, "Set OutputBuffer.FileSystemEffectivePhysicalBytesPerSectorForAtomicity to OutputBuffer.PhysicalBytesPerSectorForAtomicity.");
                this.fsaAdapter.AssertAreEqual(this.Manager, fileFsSectorSizeInfo.PhysicalBytesPerSectorForAtomicity, fileFsSectorSizeInfo.FileSystemEffectivePhysicalBytesPerSectorForAtomicity,"");
            }
        }