public void CollabProxyClient_InstantiatedWithoutPortCache_CachesNewPort() { Assert.IsFalse(File.Exists(CollabProxyClient.GetPortFilePath())); TestableCollabProxyClient theClient = new TestableCollabProxyClient(); Assert.IsTrue(File.Exists(CollabProxyClient.GetPortFilePath())); Assert.AreNotEqual(0, TestHelper.GetPortFromFile()); }
public static int GetPortFromFile() { int serverPort = 0; if (File.Exists(CollabProxyClient.GetPortFilePath())) { using (StreamReader sr = new StreamReader(CollabProxyClient.GetPortFilePath())) { int.TryParse(sr.ReadToEnd(), out serverPort); } } return(serverPort); }