Microsoft.Protocols.TestSuites.Rdpbcgr.RdpbcgrTestSuite.S1_ConnectionTest_BasicSettingExchange_NegativeTest_InvalidEncryptionMethod C# (CSharp) Method

S1_ConnectionTest_BasicSettingExchange_NegativeTest_InvalidEncryptionMethod() private method

        public void S1_ConnectionTest_BasicSettingExchange_NegativeTest_InvalidEncryptionMethod()
        {
            #region Test Steps
            //1. Trigger SUT to initiate a RDP connection and complete the Connection Initiation phase.
            //2. Test Suite expects SUT continue the connection sequence with sending a Client MCS Connect Initial PDU with GCC Conference Create Request.
            //3. Test Suite responds an invalid Server MCS Connect Response PDU with GCC Conference Create Response and set the encryptionMethod field in the Server Security Data to an invalid Encryption Method identifier.
            //4. Test Suite expects SUT drop the connection.
            #endregion

            #region
            //Start RDP listening.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Starting RDP listening with transport protocol: {0}", transportProtocol.ToString());
            this.rdpbcgrAdapter.StartRDPListening(transportProtocol);

            #region Trigger client to initiate a RDP connection
            //Trigger client to initiate a RDP connection.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Triggering SUT to initiate a RDP connection to server.");
            triggerClientRDPConnect(transportProtocol);
            #endregion

            //Expect the transport layer connection request
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting SUT to start a transport layer connection request (TCP).");
            this.rdpbcgrAdapter.ExpectTransportConnection(RDPSessionType.Normal);

            //Expect SUT send a Client X.224 Connection Request PDU.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Client X.224 Connection Request PDU");
            this.rdpbcgrAdapter.ExpectPacket<Client_X_224_Connection_Request_Pdu>(waitTime);

            //Respond a Server X.224 Connection Confirm PDU and does not set the EXTENDED_CLIENT_DATA_SUPPORTED flag.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server X.224 Connection Confirm PDU to SUT. Selected protocol: {0}", selectedProtocol.ToString());
            this.rdpbcgrAdapter.Server_X_224_Connection_Confirm(selectedProtocol, false, true, NegativeType.None);

            //Expect SUT send Client MCS Connect Initial PDU.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Client MCS Connect Initial PDU.");
            this.rdpbcgrAdapter.ExpectPacket<Client_MCS_Connect_Initial_Pdu_with_GCC_Conference_Create_Request>(waitTime);

            //Respond A Server MCS Connect Response PDU with GCC Conference Create Response and set the encryptionMethod field in the Server Security Data to an invalid Encryption Method identifier.
            this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server MCS Connect Response PDU to SUT. Encryption Method {0}; Encryption Level: {1}; RDP Version Code: {2}; Invalid encryptionMethod field.", enMethod.ToString(), enLevel.ToString(), TS_UD_SC_CORE_version_Values.V2.ToString());
            this.rdpbcgrAdapter.Server_MCS_Connect_Response(enMethod, enLevel, TS_UD_SC_CORE_version_Values.V2, NegativeType.InvalidEncryptionMethod);

            if (isWindowsImplementation)
            {
                //According to TDI#66010, the Server Security Data is only evaluated when the client security layer is connected, which is after the channels have been joined.
                #region Channel Connection phase
                //Expect a Client MCS Erect Domain Request PDU.
                this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Client MCS Erect Domain Request PDU.");
                this.rdpbcgrAdapter.ExpectPacket<Client_MCS_Erect_Domain_Request>(waitTime);

                //Expect a Client MCS Attach User Request PDU
                this.TestSite.Log.Add(LogEntryKind.Comment, "Expecting SUT to send a Client MCS Attach User Request PDU.");
                this.rdpbcgrAdapter.ExpectPacket<Client_MCS_Attach_User_Request>(waitTime);

                //Respond a Server MCS Channel Join Confirm PDU.
                this.TestSite.Log.Add(LogEntryKind.Comment, "Sending Server MCS Channel Join Confirm PDU to SUT.");
                this.rdpbcgrAdapter.MCSAttachUserConfirm(NegativeType.None);

                //Expect SUT start a channel join sequence.
                this.TestSite.Log.Add(LogEntryKind.Comment, "Expect SUT to start the  channel join sequence.");
                this.rdpbcgrAdapter.ChannelJoinRequestAndConfirm(NegativeType.None);
                #endregion
            }

            this.TestSite.Log.Add(LogEntryKind.Comment, "Expect SUT to drop the connection");
            bool bDisconnceted = this.rdpbcgrAdapter.WaitForDisconnection(waitTime);
            this.TestSite.Assert.IsTrue(bDisconnceted, "SUT should drop the connection when the encryptionMethod field in the Server Security Data is not valid or not supported.");
            #endregion
        }
RdpbcgrTestSuite