Microsoft.Protocols.TestSuites.Rdp.PtfPropUtility.GetBoolPtfProperty C# (CSharp) Method

GetBoolPtfProperty() public static method

Get a string type PTF property.
public static GetBoolPtfProperty ( ITestSite testSite, string propName, bool &propBoolValue ) : bool
testSite ITestSite The test site where to get from.
propName string The property name.
propBoolValue bool
return bool
        public static bool GetBoolPtfProperty(ITestSite testSite, string propName, out bool propBoolValue)
        {
            bool bSucceed = false;

            string propValue = testSite.Properties[propName];
            if (propValue == null)
            {
                propBoolValue = false;
                return false;
            }
            else
            {
                bSucceed = bool.TryParse(propValue, out propBoolValue);
            }

            return bSucceed;
        }

Usage Example

        protected void LoadConfig()
        {
            #region Security Approach and Protocol
            string strRDPSecurityProtocol;
            bool   isNegotiationBased = true;
            if (!PtfPropUtility.GetBoolPtfProperty(Site, "RDP.Security.Negotiation", out isNegotiationBased))
            {
                assumeFailForInvalidPtfProp("RDP.Security.Negotiation");
            }

            requestProtocol = requestedProtocols_Values.PROTOCOL_RDP_FLAG;
            if (!PtfPropUtility.GetStringPtfProperty(Site, "RDP.Security.Protocol", out strRDPSecurityProtocol))
            {
                assumeFailForInvalidPtfProp("RDP.Security.Protocol");
            }
            else
            {//TLS, CredSSP, or RDP
                if (strRDPSecurityProtocol.Equals("TLS", StringComparison.CurrentCultureIgnoreCase))
                {
                    requestProtocol = requestedProtocols_Values.PROTOCOL_SSL_FLAG;
                    if (isNegotiationBased)
                    {
                        transportProtocol = EncryptedProtocol.NegotiationTls;
                    }
                    else
                    {
                        transportProtocol = EncryptedProtocol.DirectTls;
                    }
                }
                else if (strRDPSecurityProtocol.Equals("CredSSP", StringComparison.CurrentCultureIgnoreCase))
                {
                    requestProtocol = requestedProtocols_Values.PROTOCOL_HYBRID_FLAG;
                    if (isNegotiationBased)
                    {
                        transportProtocol = EncryptedProtocol.NegotiationCredSsp;
                    }
                    else
                    {
                        transportProtocol = EncryptedProtocol.DirectCredSsp;
                    }
                }
                else if (strRDPSecurityProtocol.Equals("RDP", StringComparison.CurrentCultureIgnoreCase))
                {
                    requestProtocol = requestedProtocols_Values.PROTOCOL_RDP_FLAG;
                    if (!isNegotiationBased)
                    {
                        this.Site.Log.Add(LogEntryKind.Warning, "The property \"RDP.Security.Protocol\" is not valid and will be ingored. (When  use RDP as security protocol, the negotiation-based approch MUST be used.");
                    }
                    transportProtocol = EncryptedProtocol.Rdp;
                }
                else
                {
                    assumeFailForInvalidPtfProp("RDP.Security.Protocol");
                }
            }

            #region WaitTime
            string strWaitTime = Site.Properties["WaitTime"];
            if (strWaitTime != null)
            {
                int waitSeconds = Int32.Parse(strWaitTime);
                timeout = new TimeSpan(0, 0, waitSeconds);
            }
            #endregion

            #endregion
        }
All Usage Examples Of Microsoft.Protocols.TestSuites.Rdp.PtfPropUtility::GetBoolPtfProperty