public void CollabProxyClient_InstantiatedWithoutPortCache_HasValidConnection() { var theClient = new TestableCollabProxyClient(); theClient.StartOrConnectToServer(); Assert.IsTrue(theClient.IsConnected()); }
public void CollabProxyClient_InstantiatedWithGoodPortCache_DoesNotCacheNewPort() { var firstClient = new TestableCollabProxyClient(); var firstPort = TestHelper.GetPortFromFile(); var secondClient = new TestableCollabProxyClient(); var secondPort = TestHelper.GetPortFromFile(); Assert.AreEqual(firstPort, secondPort); }
public void CollabProxyClient_InstantiatedWithoutPortCache_CachesNewPort() { Assert.IsFalse(File.Exists(CollabProxyClient.GetPortFilePath())); var theClient = new TestableCollabProxyClient(); theClient.StartOrConnectToServer(); Assert.IsTrue(File.Exists(CollabProxyClient.GetPortFilePath())); Assert.AreNotEqual(0, TestHelper.GetPortFromFile()); }
public void CollabProxyClient_InstantiatedWithGoodPortCache_HasValidConnection() { var firstClient = new TestableCollabProxyClient(); firstClient.StartOrConnectToServer(); var secondClient = new TestableCollabProxyClient(); secondClient.StartOrConnectToServer(); Assert.IsTrue(secondClient.IsConnected()); }
public void CollabProxyClient_InstantiatedWithBadPortCache_CachesNewPort() { var firstClient = new TestableCollabProxyClient(); firstClient.StartOrConnectToServer(); Connection.StopListening(); TestableCollabProxyClient.ResetPort(k_ResetPortValue); var secondClient = new TestableCollabProxyClient(); secondClient.StartOrConnectToServer(); var secondPort = TestHelper.GetPortFromFile(); Assert.AreNotEqual(k_ResetPortValue, secondPort); }
public void SetRemoteOrigin_WhenCalled_SendsTcpMessage() { var methodCalled = false; TestHelper.RegisterListener("setremoteorigin", val => methodCalled = true); var theClient = new TestableCollabProxyClient(); theClient.StartOrConnectToServer(); IGitProxy theProxy = new GitProxy(theClient); // Make sure nothing happened up to this point Assert.IsFalse(methodCalled); theProxy.SetRemoteOrigin(""); Assert.IsTrue(methodCalled); }
public void InitializeRepository_WhenCalled_SendsTcpMessage() { var methodCalled = false; TestHelper.RegisterListener("initializerepository", val => methodCalled = true); var theClient = new TestableCollabProxyClient(); theClient.StartOrConnectToServer(); IGitProxy theProxy = new GitProxy(theClient); // Make sure nothing happened up to this point Assert.IsFalse(methodCalled); theProxy.InitializeRepository(); Assert.IsTrue(methodCalled); }
public void CallSynchronous_WhenCalledWithoutParams_SendsTcpMessageWithoutParams() { var result = ""; var methodCalled = false; var theClient = new TestableCollabProxyClient(); theClient.StartOrConnectToServer(); // Register a listener on the TCP connection TestHelper.RegisterListener("randomness", val => { methodCalled = true; result = val; }); theClient.CallSynchronous("Randomness"); Assert.IsTrue(methodCalled); Assert.AreEqual("", result); }
public void CallSynchronous_WhenCalledWithParams_SendsTcpMessageWithParams() { var result = ""; var methodCalled = false; var theClient = new TestableCollabProxyClient(); theClient.StartOrConnectToServer(); // Register a listener on the TCP connection TestHelper.RegisterListener("randomness", val => { methodCalled = true; result = val; }); theClient.CallSynchronous("Randomness", "foo", "bar"); Assert.IsTrue(methodCalled); var objects = Serialization.Deserialize <Object[]>(result); Assert.AreEqual(objects[0], "foo"); Assert.AreEqual(objects[1], "bar"); }
public void GetWorkingDirectoryChangesAsync_WhenCalled_SendsTcpMessage() { var methodCalled = false; var resetHandle = new ManualResetEvent(false); TestHelper.RegisterListener("GetWorkingDirectoryChangesAsync".ToLower(), val => { methodCalled = true; resetHandle.Set(); }); var theClient = new TestableCollabProxyClient(); theClient.StartOrConnectToServer(); IGitProxy theProxy = new GitProxy(theClient); // Make sure nothing happened up to this point Assert.IsFalse(methodCalled); theProxy.GetWorkingDirectoryChangesAsync(); resetHandle.WaitOne(); Assert.IsTrue(methodCalled); }