private void CheckSnapshotExisted(Guid snapshotId)
        {
            VHDSet_InformationType        setFileInforType = VHDSet_InformationType.SvhdxVHDSetInformationTypeSnapshotEntry;
            Snapshot_Type                 snapshotType     = Snapshot_Type.SvhdxSnapshotTypeVM;
            SVHDX_TUNNEL_OPERATION_HEADER?header;
            SVHDX_TUNNEL_VHDSET_QUERY_INFORMATION_SNAPSHOT_ENTRY_RESPONSE?snapshotEntryResponse;

            byte[] payload = client.CreateTunnelGetVHDSetFileInfoRequest(
                setFileInforType,
                snapshotType,
                snapshotId);
            uint status = client.TunnelOperation <SVHDX_TUNNEL_VHDSET_QUERY_INFORMATION_SNAPSHOT_ENTRY_RESPONSE>(
                false,//true for Async operation, false for non-async operation
                RSVD_TUNNEL_OPERATION_CODE.RSVD_TUNNEL_VHDSET_QUERY_INFORMATION,
                ++RequestIdentifier,
                payload,
                out header,
                out snapshotEntryResponse);

            BaseTestSite.Assert.AreEqual(
                (uint)Smb2Status.STATUS_SUCCESS,
                status,
                "Ioctl should succeed, actual status: {0}",
                GetStatus(status));

            VerifyTunnelOperationHeader(header.Value, RSVD_TUNNEL_OPERATION_CODE.RSVD_TUNNEL_VHDSET_QUERY_INFORMATION, (uint)RsvdStatus.STATUS_SVHDX_SUCCESS, RequestIdentifier);
        }
        /// <summary>
        /// Create an SVHDX_TUNNEL_VHDSET_QUERY_INFORMATION_REQUEST structure and marshal it to a byte array
        /// </summary>
        /// <param name="setInformationType">The set file information type requested</param>
        /// <param name="snapshotType">The snapshot type queried by this operation</param>
        /// <param name="snapshotId">The snapshot ID relevant to the particular request</param>
        /// <returns>The marshalled byte array</returns>
        public byte[] CreateTunnelGetVHDSetFileInfoRequest(
            VHDSet_InformationType setInformationType,
            Snapshot_Type snapshotType,
            Guid snapshotId)
        {
            SVHDX_TUNNEL_VHDSET_QUERY_INFORMATION_REQUEST getVHDSetFileInfoRequest = new SVHDX_TUNNEL_VHDSET_QUERY_INFORMATION_REQUEST();

            getVHDSetFileInfoRequest.VHDSetInformationType = setInformationType;
            getVHDSetFileInfoRequest.SnapshotType          = snapshotType;
            getVHDSetFileInfoRequest.SnapshotId            = snapshotId;

            return(TypeMarshal.ToBytes(getVHDSetFileInfoRequest));
        }
        public void BVT_Query_VHDSet_FileInfo_SnapshotEntry()
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "1.	Client opens a shared virtual disk file and expects success.");
            OpenSharedVHD(TestConfig.NameOfSharedVHDS, RSVD_PROTOCOL_VERSION.RSVD_PROTOCOL_VERSION_2);

            System.Guid snapshotId = System.Guid.NewGuid();
            CreateSnapshot(snapshotId);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2.	Client sends tunnel operation SVHDX_TUNNEL_VHDSET_FILE_QUERY_INFORMATION_REQUEST to server and expects success.");
            VHDSet_InformationType        setFileInforType = VHDSet_InformationType.SvhdxVHDSetInformationTypeSnapshotEntry;
            Snapshot_Type                 snapshotType     = Snapshot_Type.SvhdxSnapshotTypeVM;
            SVHDX_TUNNEL_OPERATION_HEADER?header;
            SVHDX_TUNNEL_VHDSET_QUERY_INFORMATION_SNAPSHOT_ENTRY_RESPONSE?snapshotEntryResponse;

            byte[] payload = client.CreateTunnelGetVHDSetFileInfoRequest(
                setFileInforType,
                snapshotType,
                snapshotId);
            uint status = client.TunnelOperation <SVHDX_TUNNEL_VHDSET_QUERY_INFORMATION_SNAPSHOT_ENTRY_RESPONSE>(
                false,//true for Async operation, false for non-async operation
                RSVD_TUNNEL_OPERATION_CODE.RSVD_TUNNEL_VHDSET_QUERY_INFORMATION,
                ++RequestIdentifier,
                payload,
                out header,
                out snapshotEntryResponse);

            BaseTestSite.Assert.AreEqual(
                (uint)Smb2Status.STATUS_SUCCESS,
                status,
                "Ioctl should succeed, actual status: {0}",
                GetStatus(status));

            VerifyTunnelOperationHeader(header.Value, RSVD_TUNNEL_OPERATION_CODE.RSVD_TUNNEL_VHDSET_QUERY_INFORMATION, (uint)RsvdStatus.STATUS_SVHDX_SUCCESS, RequestIdentifier);

            VerifyFieldInResponse("SetFileInformationType", VHDSet_InformationType.SvhdxVHDSetInformationTypeSnapshotEntry, snapshotEntryResponse.Value.VHDSetInformationType);

            DeleteSnapshot(snapshotId);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "3.	Client closes the file.");
            client.CloseSharedVirtualDisk();
        }
        public void BVT_Query_VHDSet_FileInfo_SnapshotList()
        {
            BaseTestSite.Log.Add(LogEntryKind.TestStep, "1.	Client opens a shared virtual disk file and expects success.");
            OpenSharedVHD(TestConfig.NameOfSharedVHDS, RSVD_PROTOCOL_VERSION.RSVD_PROTOCOL_VERSION_2);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "2.	Client sends tunnel operation SVHDX_TUNNEL_VHDSET_FILE_QUERY_INFORMATION_REQUEST to server and expects success.");
            VHDSet_InformationType setFileInforType = VHDSet_InformationType.SvhdxVHDSetInformationTypeSnapshotList;
            Snapshot_Type          snapshotType     = Snapshot_Type.SvhdxSnapshotTypeVM;

            //SnapshotId is set to empty when SetFileInformationType is SvhdxSetFileInformationTypeSnapshotList because
            //this message is intending to get the snapshot id list from server, when you need to get a snapshot entry, you need to pass in the specific snapshot id
            System.Guid snapshotId = System.Guid.Empty;

            // Get VHDSet info
            byte[] payload = client.CreateTunnelGetVHDSetFileInfoRequest(
                setFileInforType,
                snapshotType,
                snapshotId);
            SVHDX_TUNNEL_OPERATION_HEADER?header;
            SVHDX_TUNNEL_VHDSET_QUERY_INFORMATION_SNAPSHOT_LIST_RESPONSE?response;
            uint status = client.TunnelOperation <SVHDX_TUNNEL_VHDSET_QUERY_INFORMATION_SNAPSHOT_LIST_RESPONSE>(
                false,//true for Async operation, false for non-async operation
                RSVD_TUNNEL_OPERATION_CODE.RSVD_TUNNEL_VHDSET_QUERY_INFORMATION,
                ++RequestIdentifier,
                payload,
                out header,
                out response);

            BaseTestSite.Assert.AreEqual(
                (uint)Smb2Status.STATUS_SUCCESS,
                status,
                "Ioctl should succeed, actual status: {0}",
                GetStatus(status));

            VerifyTunnelOperationHeader(header.Value, RSVD_TUNNEL_OPERATION_CODE.RSVD_TUNNEL_VHDSET_QUERY_INFORMATION, (uint)RsvdStatus.STATUS_SVHDX_SUCCESS, RequestIdentifier);

            VerifyFieldInResponse("SetFileInformationType", VHDSet_InformationType.SvhdxVHDSetInformationTypeSnapshotList, response.Value.VHDSetInformationType);

            BaseTestSite.Log.Add(LogEntryKind.TestStep, "3.	Client closes the file.");
            client.CloseSharedVirtualDisk();
        }