Пример #1
0
        public void ShouldSupportGeneratingCollections()
        {
            const int anyCount             = 3;
            var       list                 = Any.List <RecursiveInterface>();
            var       array                = Any.Array <RecursiveInterface>();
            var       set                  = Any.Set <RecursiveInterface>();
            var       dictionary           = Any.Dictionary <RecursiveInterface, ISimple>();
            var       sortedList           = Any.SortedList <string, ISimple>();
            var       sortedDictionary     = Any.SortedDictionary <string, ISimple>();
            var       sortedEnumerable     = Any.EnumerableSortedDescending <string>();
            var       enumerable           = Any.Enumerable <RecursiveInterface>();
            var       concurrentDictionary = Any.ConcurrentDictionary <string, ISimple>();
            var       concurrentBag        = Any.ConcurrentBag <string>();
            var       concurrentQueue      = Any.ConcurrentQueue <string>();
            var       concurrentStack      = Any.ConcurrentStack <string>();

            Assert.Multiple(() =>
            {
                Assert.AreEqual(anyCount, list.Count);
                Assert.AreEqual(anyCount, enumerable.Count());
                Assert.AreEqual(anyCount, array.Length);
                Assert.AreEqual(anyCount, set.Count);
                Assert.AreEqual(anyCount, dictionary.Count);
                Assert.AreEqual(anyCount, sortedList.Count);
                Assert.AreEqual(anyCount, sortedDictionary.Count);
                Assert.AreEqual(anyCount, sortedEnumerable.Count());
                Assert.AreEqual(anyCount, concurrentDictionary.Count);
                Assert.AreEqual(anyCount, concurrentBag.Count);
                Assert.AreEqual(anyCount, concurrentStack.Count);
                Assert.AreEqual(anyCount, concurrentQueue.Count);
            });
        }