/// <summary> /// Parses the MC settings and returns the corresponding UFT settings. /// </summary> /// <param name="mcConnectionInfo"> the mc settings</param> /// <returns> the parallel runner uft settings </returns> public static UFTSettings ParseMCSettings(McConnectionInfo mcConnectionInfo) { if (string.IsNullOrEmpty(mcConnectionInfo.MobileHostAddress) || string.IsNullOrEmpty(mcConnectionInfo.MobileUserName) || string.IsNullOrEmpty(mcConnectionInfo.MobilePassword) || string.IsNullOrEmpty(mcConnectionInfo.MobileHostPort)) { return(null); } MCSettings mcSettings = new MCSettings { username = mcConnectionInfo.MobileUserName, password = WinUserNativeMethods.ProtectBSTRToBase64(mcConnectionInfo.MobilePassword), hostname = mcConnectionInfo.MobileHostAddress, port = Convert.ToInt32(mcConnectionInfo.MobileHostPort), protocol = mcConnectionInfo.MobileUseSSL > 0 ? "https" : "http", tenantId = mcConnectionInfo.MobileTenantId, }; var proxy = GetMCProxySettings(mcConnectionInfo); // set the proxy information if we have it if (proxy != null) { mcSettings.proxy = proxy; } UFTSettings uftSettings = new UFTSettings { mc = mcSettings }; return(uftSettings); }
public void ParseMCSettingsTest_InvalidMCSettings_ReturnsNullSettings() { McConnectionInfo mcConnectionInfo = new McConnectionInfo(); UFTSettings settings = ParallelRunnerEnvironmentUtil.ParseMCSettings(mcConnectionInfo); Assert.IsNull(settings); }
public void ParseMCSettingsTest_ValidMCSettingsNonSSL_ReturnsExpectedSettings() { McConnectionInfo mcConnectionInfo = new McConnectionInfo(); mcConnectionInfo.MobileHostAddress = "192.168.1.1"; mcConnectionInfo.MobileHostPort = "8080"; mcConnectionInfo.MobileUserName = "******"; mcConnectionInfo.MobilePassword = "******"; UFTSettings settings = ParallelRunnerEnvironmentUtil.ParseMCSettings(mcConnectionInfo); Assert.IsNotNull(settings); Assert.IsNotNull(settings.mc); Assert.AreEqual(mcConnectionInfo.MobileHostAddress, settings.mc.hostname); Assert.AreEqual(mcConnectionInfo.MobileHostPort, settings.mc.port.ToString()); Assert.AreEqual(mcConnectionInfo.MobileUserName, settings.mc.username); Assert.AreEqual("http", settings.mc.protocol); }