public async Task WhenGetBrokerStatsIsCalledAgain_StatsAreAddedToTheList()
        {
            var brokerClient = new BrokerClient(new MockBrokerServiceLocatorMultiPartition());
            await brokerClient.GetBrokerStatsAsync();

            var queueStats = await brokerClient.GetBrokerStatsAsync();

            Assert.IsTrue(queueStats.Count == 2);
            Assert.IsTrue(queueStats.ContainsKey("MessageOneQueue") && queueStats["MessageOneQueue"].Count == 2 && queueStats["MessageOneQueue"].Last().TotalDelivered == 39);
            Assert.IsTrue(queueStats.ContainsKey("MessageTwoQueue") && queueStats["MessageTwoQueue"].Count == 2 && queueStats["MessageTwoQueue"].Last().TotalReceived == 510);
        }
        public async Task WhenGetQueueCapacityIsExceeded_OldestStatsAreTrimmed()
        {
            var brokerClient = new BrokerClient(new MockBrokerServiceLocatorMultiPartition())
            {
                QueueStatCapacity = 2
            };
            await brokerClient.GetBrokerStatsAsync();

            await brokerClient.GetBrokerStatsAsync();

            var queueStats = await brokerClient.GetBrokerStatsAsync();

            Assert.IsTrue(queueStats.Count == 2);
            Assert.IsTrue(queueStats.ContainsKey("MessageOneQueue") && queueStats["MessageOneQueue"].Count == 2 && queueStats["MessageOneQueue"].First().TotalDelivered == 39);
            Assert.IsTrue(queueStats.ContainsKey("MessageTwoQueue") && queueStats["MessageTwoQueue"].Count == 2 && queueStats["MessageTwoQueue"].First().TotalReceived == 510);
        }
        public async Task WhenGetBrokerStatsIsCalled_AggregatesBrokerStatsFromMultiplePartitions()
        {
            var brokerClient = new BrokerClient(new MockBrokerServiceLocatorMultiPartition());
            var queueStats   = await brokerClient.GetBrokerStatsAsync();

            Assert.IsTrue(queueStats.Count == 2);
            Assert.IsTrue(queueStats.ContainsKey("MessageOneQueue") && queueStats["MessageOneQueue"].Count == 1 && queueStats["MessageOneQueue"].First().TotalDelivered == 34);
            Assert.IsTrue(queueStats.ContainsKey("MessageTwoQueue") && queueStats["MessageTwoQueue"].Count == 1 && queueStats["MessageTwoQueue"].First().TotalReceived == 500);
        }
        public async Task WhenGetBrokerStatsIsEmpty_EmptyDictionaryIsReturned()
        {
            var brokerClient = new BrokerClient(new MockBrokerServiceLocatorMultiPartition(new List <IBrokerService>
            {
                new MockBrokerService(),
                new MockBrokerService()
            }));

            var queueStats = await brokerClient.GetBrokerStatsAsync();

            Assert.IsTrue(queueStats.Count == 0);
        }