public void ServerProxyWithoutChunking_GivenServerAvailable_AndConnect_WhenDisconnectRequest_ExpectDisconnect()
        {
            var proxy = new ServerProxyWithoutChunking(new Uri("http://localhost:3142"));

            var stateControllerCurrent = proxy.StateController.Current;

            var disconnected = stateControllerCurrent == ConnState.Disconnected;

            Assert.IsTrue(disconnected);

            Assert.AreEqual(ConnState.Disconnected, stateControllerCurrent);
            Assert.AreEqual(ConnState.Disconnected, proxy.State);
            // When creating a new connection, what ensures that the MoveToState has a guid to compare?
            proxy.Connect(Guid.NewGuid());
            while (proxy.HubConnection.State != SignalR.Wrappers.ConnectionStateWrapped.Connected)
            {
                System.Threading.Thread.Sleep(1000);
            }

            Assert.AreEqual(ConnState.Connected, proxy.StateController.Current);
            Assert.AreEqual(ConnState.Connected, proxy.State);

            proxy.Disconnect();
            Assert.AreEqual(ConnState.Disconnected, proxy.StateController.Current);
            Assert.AreEqual(ConnState.Disconnected, proxy.State);
        }
        public void ServerProxy_HandleItemAdded()
        {
            //------------Setup for test--------------------------
            var serverProxy = new ServerProxyWithoutChunking(new Uri("http://bob"));
            var serverGuid  = Guid.NewGuid();
            var ItemGuid    = Guid.Empty;

            try
            {
                serverProxy.Connect(serverGuid);
            }
            // ReSharper disable EmptyGeneralCatchClause
            catch
            // ReSharper restore EmptyGeneralCatchClause
            {
            }
            //------------Execute Test---------------------------
            ServerExplorerItem item = new ServerExplorerItem("bob", Guid.Empty, ResourceType.DbService, null, Permissions.Administrator, "bob");

            serverProxy.ItemAddedMessageAction += explorerItem => { ItemGuid = explorerItem.ServerId; };
            Dev2JsonSerializer dev = new Dev2JsonSerializer();
            var           output   = dev.SerializeToBuilder(item);
            PrivateObject p        = new PrivateObject(serverProxy);

            p.Invoke("OnItemAddedMessageReceived", output.ToString());
            Assert.AreEqual(ItemGuid, serverGuid);
            //------------Assert Results-------------------------
            var subscription = serverProxy.EsbProxy.Subscribe("SendDebugState");

            Assert.IsNotNull(subscription);
        }
        public void ServerProxyWithoutChunking_GivenServerAvailable_ExpectConnected()
        {
            var proxy = new ServerProxyWithoutChunking(new Uri("http://localhost:3142"));

            Assert.AreEqual(ConnState.Disconnected, proxy.StateController.Current);
            Assert.AreEqual(ConnState.Disconnected, proxy.State);
            proxy.Connect(Guid.NewGuid());
            while (proxy.HubConnection.State != SignalR.Wrappers.ConnectionStateWrapped.Connected)
            {
                System.Threading.Thread.Sleep(1000);
            }

            Assert.AreEqual(ConnState.Connected, proxy.StateController.Current);
            Assert.AreEqual(ConnState.Connected, proxy.State);
        }