/// <summary>
        /// Verify the datatype of FileGetQuotaInformation
        /// </summary>
        /// <param name="fileGetQuotaInformation">the instance of Verify the datatype of FileGetQuotaInformation</param>
        /// <param name="isMutipleEntries">check if multiple entries are present in a buffer</param>
        public void VerifyDataTypeFileGetQuotaInformation(FILE_QUOTA_INFORMATION fileGetQuotaInformation,
            bool isMutipleEntries)
        {
            Site.DefaultProtocolDocShortName = "MS-FSCC";
            //
            // Add the debug information
            //
            Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1549");

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1549
            //
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(uint),
                fileGetQuotaInformation.NextEntryOffset.GetType(),
                1549,
                @"[In FileGetQuotaInformation]NextEntryOffset (4 bytes):  A 32-bit unsigned integer that contains the byte offset from the beginning of this entry, at which the next FILE_GET_QUOTA_INFORMATION entry is located, if multiple entries are present in a buffer.");

            if (isMutipleEntries)
            {
                //
                // Add the debug information
                //
                Site.Log.Add(LogEntryKind.Debug, "Verify MS-FSCC_R1551");

                //
                // Verify MS-FSCC requirement: MS-FSCC_R1551
                //
                // NextEntryOffset is equal to the sid length and the size (4 bytes) of NextEntryOffset field
                Site.CaptureRequirementIfAreEqual<uint>(
                    fileGetQuotaInformation.SidLength + 4,
                    fileGetQuotaInformation.NextEntryOffset,
                    1551,
                    @"[In FileGetQuotaInformation]NextEntryOffset (4 bytes): An implementation MUST use this value to determine the location of the next entry (if multiple entries are present in a buffer).");
            }

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

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1555
            //
            // The structure is got by the stack parsing according to the format
            // so here the type is to be verified
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(SID),
                fileGetQuotaInformation.Sid.GetType(),
                1555,
                @"[In FileGetQuotaInformation]Sid (variable): SIDs are sent in little-endian format and require no packing.");

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

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1556
            //
            // from stack parese, if the type is SID, the format can be verified
            Site.CaptureRequirementIfAreEqual<Type>(
                typeof(SID),
                fileGetQuotaInformation.Sid.GetType(),
                1556,
                @"[In FileGetQuotaInformation]Sid (variable): The format of a SID is as specified in [MS-DTYP] section 2.4.2.");

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

            //
            // Verify MS-FSCC requirement: MS-FSCC_R1553
            //
            Site.CaptureRequirementIfAreEqual<uint>(
                (uint)Marshal.SizeOf(fileGetQuotaInformation.Sid),
                fileGetQuotaInformation.SidLength,
                1553,
                @"[In FileGetQuotaInformation]SidLength (4 bytes):  A 32-bit unsigned integer that contains the length, in bytes, of the <Sid> data element.");

            // NextEntryOffset is set 0
            if (0 == fileGetQuotaInformation.NextEntryOffset)
            {
                // here cannot be sure whether the parsing will continue when NextEntryOffset is 0,
                // so no other entries following is thought by default, just to capture this requirment directly
                Site.CaptureRequirement(
                    1550,
                    @"[In FileGetQuotaInformation]NextEntryOffset (4 bytes): This member MUST be zero if no other entries follow this one[FILE_GET_QUOTA_INFORMATION entry].");
            }

            // Above verification has been done for FileGetQuotaInformation structure,
            // so capture this requirment directly
            Site.CaptureRequirement(
                1548,
                @"The information class[FileGetQuotaInformation] is used to provide the list of SIDs for which query quota information is requested.");

            Site.DefaultProtocolDocShortName = Site.Properties["ProtocolShortName"];
        }
        public void QuotaInfo_Set_QuotaInformation_IsQuotaInfoSupported()
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "Test case steps:");
            MessageStatus status;

            //Step 1: Open Quota file
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "1. Open Quota file " + this.fsaAdapter.QuotaFile);
            status = this.fsaAdapter.CreateFile(
                        this.fsaAdapter.QuotaFile,
                        FileAttribute.NORMAL,
                        CreateOptions.SYNCHRONOUS_IO_NONALERT,
                        FileAccess.FILE_READ_DATA | FileAccess.FILE_WRITE_DATA |
                        FileAccess.FILE_READ_ATTRIBUTES | FileAccess.FILE_WRITE_ATTRIBUTES | FileAccess.SYNCHRONIZE,
                        ShareAccess.FILE_SHARE_READ | ShareAccess.FILE_SHARE_WRITE,
                        CreateDisposition.OPEN);

            if (this.fsaAdapter.IsQuotaSupported == false)
            {
                this.fsaAdapter.AssertAreEqual(this.Manager, true,
                    (status == MessageStatus.OBJECT_PATH_NOT_FOUND || status == MessageStatus.OBJECT_NAME_NOT_FOUND),
                    "Quota file is not supported and expected to fail.");
                return;
            }

            //Step 2: Query Quota Information
            long byteCount;
            byte[] outputBuffer;
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2. Query Quota Information.");
            if (this.fsaAdapter.Transport == Transport.SMB)
            {
                SMB_QUERY_QUOTA_INFO smbQueryQuotaInfo = new SMB_QUERY_QUOTA_INFO();
                smbQueryQuotaInfo.ReturnSingleEntry = 0;
                smbQueryQuotaInfo.RestartScan = 1;
                smbQueryQuotaInfo.SidListLength = 0;
                smbQueryQuotaInfo.StartSidLength = 0;
                smbQueryQuotaInfo.StartSidOffset = 0;

                status = this.fsaAdapter.QueryFileQuotaInformation(smbQueryQuotaInfo, 2048, out byteCount, out outputBuffer);
            }
            else
            {
                SMB2_QUERY_QUOTA_INFO smb2QueryQuotaInfo = new SMB2_QUERY_QUOTA_INFO();
                smb2QueryQuotaInfo.ReturnSingle = 0;
                smb2QueryQuotaInfo.RestartScan = 1;
                smb2QueryQuotaInfo.Reserved = 0;
                smb2QueryQuotaInfo.SidListLength = 0;
                smb2QueryQuotaInfo.StartSidLength = 0;
                smb2QueryQuotaInfo.StartSidOffset = 0;

                status = this.fsaAdapter.QueryFileQuotaInformation(smb2QueryQuotaInfo, 2048, out byteCount, out outputBuffer);
            }

            //Step 3: Set Quota Information
            FILE_QUOTA_INFORMATION[] fileQuotaInformationEntries = FsaUtility.UnmarshalFileQuotaInformation(outputBuffer);
            if (fileQuotaInformationEntries.Length > 0)
            {
                FILE_QUOTA_INFORMATION quotaEntry = fileQuotaInformationEntries[0];
                FILE_QUOTA_INFORMATION fileQuotaInfo = new FILE_QUOTA_INFORMATION();
                fileQuotaInfo.NextEntryOffset = 0;
                fileQuotaInfo.SidLength = (uint)quotaEntry.Sid.Length;
                fileQuotaInfo.ChangeTime = new _FILETIME();
                fileQuotaInfo.QuotaUsed = 0;
                fileQuotaInfo.QuotaThreshold = 1024 * 1024; //Set warning Level 1MB
                fileQuotaInfo.QuotaLimit = -1;
                fileQuotaInfo.Sid = quotaEntry.Sid;

                BaseTestSite.Log.Add(LogEntryKind.TestStep, "3. Set Quota Information.");
                status = this.fsaAdapter.SetFileQuotaInformation(fileQuotaInfo);

                //Step 4: Verify test result
                BaseTestSite.Log.Add(LogEntryKind.TestStep, "4. Verify returned NTStatus code.");
                this.fsaAdapter.AssertAreEqual(this.Manager, MessageStatus.SUCCESS, status,
                        "Quota is supported, status set to STATUS_SUCCESS.");
            }
        }