Exemplo n.º 1
0
        public void NewRequestPool_WhenStarted_ShouldTearDownWhenStopped()
        {
            var clientNetworkLayer = new ClientTestNetworkLinkLayer();
            var transportLayer     = new ClientTestTransportLayer(clientNetworkLayer);

            var requestPool = new RequestPool <ClientControlFrame>(transportLayer);

            requestPool.Start();
            Assert.AreEqual(requestPool.InitialClientSize, requestPool.ActiveClients);

            requestPool.StopAsync().Wait();
            Assert.AreEqual(0, requestPool.ActiveClients);
        }
Exemplo n.º 2
0
        public void NewRequestPool_WhenStarted_ShouldStartUpDefinedNumberOfClients()
        {
            var clientNetworkLayer = new ClientTestNetworkLinkLayer();
            var transportLayer     = new ClientTestTransportLayer(clientNetworkLayer);

            var requestPool = new RequestPool <ClientControlFrame>(transportLayer, 4);

            requestPool.Start();

            Assert.AreEqual(requestPool.InitialClientSize, requestPool.ActiveClients);

            requestPool.Stop();
        }
Exemplo n.º 3
0
        public void NewRequestPool_WhenStarted_ShouldSendControlMessages()
        {
            var clientNetworkLayer = new ClientTestNetworkLinkLayer();
            var transportLayer     = new ClientTestTransportLayer(clientNetworkLayer);

            var requestPool = new RequestPool <ClientControlFrame>(transportLayer);

            requestPool.Start();
            requestPool.Stop();

            var frames = clientNetworkLayer.SentBytes.Select(this.clientFrameEncoder.Decode).ToList();

            Assert.IsTrue(frames.Any());
            Assert.IsTrue(frames.OfType <ClientControlFrame>().Any());
        }