public void CollabProxyClient_InstantiatedWithGoodPortCache_HasValidConnection()
        {
            TestableCollabProxyClient firstClient  = new TestableCollabProxyClient();
            TestableCollabProxyClient secondClient = new TestableCollabProxyClient();

            Assert.IsTrue(secondClient.IsConnected());
        }
        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 void CollabProxyClient_InstantiatedWithGoodPortCache_DoesNotCacheNewPort()
        {
            TestableCollabProxyClient firstClient = new TestableCollabProxyClient();
            int firstPort = TestHelper.GetPortFromFile();
            TestableCollabProxyClient secondClient = new TestableCollabProxyClient();
            int secondPort = TestHelper.GetPortFromFile();

            Assert.AreEqual(firstPort, secondPort);
        }
        public void CollabProxyClient_InstantiatedWithBadPortCache_CachesNewPort()
        {
            TestableCollabProxyClient firstClient = new TestableCollabProxyClient();

            Connection.StopListening();
            firstClient.ResetPort(k_ResetPortValue);
            TestableCollabProxyClient secondClient = new TestableCollabProxyClient();
            int secondPort = TestHelper.GetPortFromFile();

            Assert.AreNotEqual(k_ResetPortValue, secondPort);
        }
Exemplo n.º 5
0
        public void SetRemoteOrigin_WhenCalled_SendsTcpMessage()
        {
            bool methodCalled = false;
            TestableCollabProxyClient theClient = new TestableCollabProxyClient();

            TestHelper.RegisterListener("setremoteorigin", val => { methodCalled = true; });
            IGitProxy theProxy = new GitProxy(theClient);

            // Make sure nothing happened up to this point
            Assert.IsFalse(methodCalled);
            theProxy.SetRemoteOrigin("");
            Assert.IsTrue(methodCalled);
        }
Exemplo n.º 6
0
        public void InitializeRepository_WhenCalled_SendsTcpMessage()
        {
            bool methodCalled = false;
            TestableCollabProxyClient theClient = new TestableCollabProxyClient();

            TestHelper.RegisterListener("initializerepository", val => { methodCalled = true; });
            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()
        {
            string result       = "";
            bool   methodCalled = false;
            TestableCollabProxyClient theClient = new TestableCollabProxyClient();

            // 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()
        {
            string result       = "";
            bool   methodCalled = false;
            TestableCollabProxyClient theClient = new TestableCollabProxyClient();

            // Register a listener on the TCP connection
            TestHelper.RegisterListener("randomness", val =>
            {
                methodCalled = true;
                result       = val;
            });
            theClient.CallSynchronous("Randomness", "foo", "bar");
            Assert.IsTrue(methodCalled);
            Object[] objects = Serialization.Deserialize <Object[]>(result);
            Assert.AreEqual(objects[0], "foo");
            Assert.AreEqual(objects[1], "bar");
        }
Exemplo n.º 9
0
        public void GetWorkingDirectoryChangesAsync_WhenCalled_SendsTcpMessage()
        {
            bool methodCalled = false;
            TestableCollabProxyClient theClient = new TestableCollabProxyClient();

            ManualResetEvent resetHandle = new ManualResetEvent(false);

            TestHelper.RegisterListener("GetWorkingDirectoryChangesAsync".ToLower(),
                                        val =>
            {
                methodCalled = true;
                resetHandle.Set();
            });

            IGitProxy theProxy = new GitProxy(theClient);

            // Make sure nothing happened up to this point
            Assert.IsFalse(methodCalled);
            theProxy.GetWorkingDirectoryChangesAsync();
            resetHandle.WaitOne();
            Assert.IsTrue(methodCalled);
        }
        public void CollabProxyClient_InstantiatedWithoutPortCache_HasValidConnection()
        {
            TestableCollabProxyClient theClient = new TestableCollabProxyClient();

            Assert.IsTrue(theClient.IsConnected());
        }