Exemplo n.º 1
0
        public async Task EnumerateWithNonMetricCollections()
        {
            Uri dictionaryName = new Uri("test://dictionary");
            Uri queueName      = new Uri("test://queue");

            MetricReliableStateManager target = new MetricReliableStateManager(
                this.GetContext(),
                new JsonReliableStateSerializerResolver(),
                this.GetConfig(),
                new MockReliableStateManager());

            await target.GetOrAddAsync <IReliableDictionary <int, string> >(dictionaryName);

            await target.GetOrAddAsync <IReliableQueue <string> >(queueName);

            List <IReliableState> result = new List <IReliableState>();
            await target.ForeachAsync <IReliableState>(CancellationToken.None, x => result.Add(x));

            Assert.AreEqual <int>(2, result.Count);
            Assert.AreEqual <int>(1, result.Count(x => x.Name == queueName));
            Assert.AreEqual <int>(1, result.Count(x => x.Name == dictionaryName && x is MetricReliableDictionary <int, string>));
        }