public async Task Instantiate_and_keep_a_ClientProxy_in_the_pool_when_Starting_a_subscription()
        {
            const string showId = "7";

            var proxyPool = new ClientProxyPool(PublisherFactory.GetFakePublisher(),
                                                new ShowReservationsWatcherPool(InstantiateFakeReservationProvider(showId)));
            const string connectionId = "SignalRStuff-45";
            var          initialReservedSeatsAsViewedByTheClient = new List <string> {
                "Z1", "Z27"
            };

            var clientProxy = proxyPool.GetClientProxy(showId, connectionId);

            Check.That(clientProxy).IsNull();

            await proxyPool.StartSubscription(showId, connectionId, initialReservedSeatsAsViewedByTheClient);

            clientProxy = proxyPool.GetClientProxy(showId, connectionId);
            Check.That(clientProxy).IsNotNull();
        }
        public async Task Remove_the_ClientProxy_from_the_pool_when_ending_its_subscription()
        {
            const string showId    = "7";
            var          proxyPool = new ClientProxyPool(PublisherFactory.GetFakePublisher(),
                                                         new ShowReservationsWatcherPool(InstantiateFakeReservationProvider(showId)));
            const string connectionId = "SignalRStuff-45";

            var clientProxy = proxyPool.GetClientProxy(showId, connectionId);

            Check.That(clientProxy).IsNull();

            await proxyPool.StartSubscription(showId, connectionId, new List <string>());

            clientProxy = proxyPool.GetClientProxy(showId, connectionId);
            Check.That(clientProxy).IsNotNull();

            proxyPool.EndSubscription(showId, connectionId);

            // The client proxy is not within the pool now
            clientProxy = proxyPool.GetClientProxy(showId, connectionId);
            Check.That(clientProxy).IsNull();
        }
        Register_the_ClientProxy_as_an_observer_of_a_showReservationWatcher_when_Starting_a_subscription()
        {
            const string showId = "7";
            var          showReservationsWatcherPool =
                new ShowReservationsWatcherPool(InstantiateFakeReservationProvider(showId));
            var          proxyPool    = new ClientProxyPool(PublisherFactory.GetFakePublisher(), showReservationsWatcherPool);
            const string connectionId = "SignalRStuff-45";
            var          initialReservedSeatsAsViewedByTheClient = new List <string> {
                "Z1", "Z27"
            };

            var clientProxy = proxyPool.GetClientProxy(showId, connectionId);

            Check.That(clientProxy).IsNull();

            await proxyPool.StartSubscription(showId, connectionId, initialReservedSeatsAsViewedByTheClient);

            clientProxy = proxyPool.GetClientProxy(showId, connectionId);
            Check.That(clientProxy).IsNotNull();

            var watcherForShow7 = showReservationsWatcherPool.GetWatcherForShow(showId);

            Check.That(watcherForShow7.IsObservedBy(clientProxy)).IsTrue();
        }