[Test] public void mapTMServerUrl() { Assert.AreEqual(SendEmails.TM_Server_URL, TMConsts.DEFAULT_TM_LOCALHOST_SERVER_URL); var context = HttpContextFactory.Context.mock(); var request = HttpContextFactory.Request; Assert.IsNotNull(context); Assert.IsNotNull(request); Assert.IsFalse(request.IsSecureConnection); var serverName = 10.randomLetters(); var serverPort = 60000.random().str(); request.ServerVariables["Server_Name"] = serverName; request.ServerVariables["Server_Port"] = serverPort; Assert.AreEqual(request.ServerVariables["Server_Name"], serverName); Assert.AreEqual(request.ServerVariables["Server_Port"], serverPort); //request.IsSecureConnection = false; SendEmails.TM_Server_URL = null; var expectedServer = "http://{0}:{1}".format(serverName, serverPort); var serverUrl = SendEmails.mapTMServerUrl(); Assert.AreEqual(serverUrl, expectedServer); Assert.AreEqual(serverUrl, SendEmails.TM_Server_URL); SendEmails.TM_Server_URL = TMConsts.DEFAULT_TM_LOCALHOST_SERVER_URL; }