Exemplo n.º 1
0
        public async Task GetItems_MultipleParts()
        {
            var inner = new Group("Inner".ToCharArray())
            {
                InnerItems = new List <Item>()
                {
                    new Group("Final1".ToCharArray()),
                    new Group("Final2".ToCharArray()),
                }
            };

            var rootArr = new Group[]
            {
                new Group("Test1".ToCharArray())
                {
                    InnerItems = new List <Item>()
                    {
                        inner
                    }
                },
                new Group("Test2".ToCharArray()),
                new Group("Test3".ToCharArray())
            };

            for (int i = 0; i < rootArr.Length; i++)
            {
                await ABSRegistry.AddItemToRootAsync(rootArr[i]);
            }

            CollectionAssert.AreEqual(inner.InnerItems, await ABSRegistry.GetItemsAsync("Test1/Inner"));
            CollectionAssert.AreEqual(inner.InnerItems, await ABSRegistry.GetItemsAsync("/Test1/Inner"));
        }
Exemplo n.º 2
0
        public async Task GetItems_FromRoot()
        {
            var rootArr = new Group[]
            {
                new Group("Test1".ToCharArray()),
                new Group("Test2".ToCharArray()),
                new Group("Test3".ToCharArray())
            };

            for (int i = 0; i < rootArr.Length; i++)
            {
                await ABSRegistry.AddItemToRootAsync(rootArr[i]);
            }

            CollectionAssert.AreEqual(rootArr, await ABSRegistry.GetItemsAsync("/"));
        }
Exemplo n.º 3
0
        public async Task GetItems_InvalidPath()
        {
            var rootArr = new Group[]
            {
                new Group("Test1".ToCharArray()),
                new Group("Test2".ToCharArray()),
                new Group("Test3".ToCharArray())
            };

            for (int i = 0; i < rootArr.Length; i++)
            {
                await ABSRegistry.AddItemToRootAsync(rootArr[i]);
            }

            try
            {
                // This should throw an exception, meaning the "Assert.Fail" never gets hit.
                await ABSRegistry.GetItemsAsync("Test4");

                Assert.Fail();
            } catch (Exception) { }
        }