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")); }
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("/")); }
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) { } }