public void ShouldFindItemCatalogs() { string itemName = "Test RenameItem ".RandomLetters(8); string newName = "New Name ".RandomLetters(8); CatalogService svc = _serviceRegistry.Get <CatalogService>(); CatalogDefinition catalog = svc.CreateCatalog(5.RandomLetters()); CatalogDefinition catalog2 = svc.CreateCatalog(6.RandomLetters()); ItemDefinition item = svc.CreateItem(itemName); svc.AddItem(catalog.Cuid, item.Cuid); svc.AddItem(catalog2.Cuid, item.Cuid); string[] catalogCuids = svc.FindItemCatalogs(item.Cuid); Expect.AreEqual(2, catalogCuids.Length); }
public void CanGetCatalogByCuid() { string catalogName = "Test Catalog To Find ".RandomLetters(10); CatalogService svc = _serviceRegistry.Get <CatalogService>(); CatalogDefinition catalog = svc.CreateCatalog(catalogName); CatalogDefinition gotCatalog = svc.GetCatalog(catalog.Cuid); Expect.IsNotNull(gotCatalog, "catalog was null"); Expect.AreEqual(catalogName, gotCatalog.Name); }
public void CanCreateCatalog() { string catalogName = "Test Catalog Name ".RandomLetters(8); CatalogService svc = _serviceRegistry.Get <CatalogService>(); CatalogDefinition catalog = svc.CreateCatalog(catalogName); Expect.IsNotNull(catalog, "catalog was null"); Expect.AreEqual(catalogName, catalog.Name); Expect.IsNotNullOrEmpty(catalog.Cuid, "cuid was not set"); }
public void CanCreateCatalog() { CatalogService svc = GetTestCatalogService(nameof(CanCreateCatalog), out DaoRepository ignore); string testCatalogName = "TestCatalog"; CatalogDefinition catalogDefinition = svc.CreateCatalog(testCatalogName); Expect.IsNotNull(catalogDefinition); Expect.IsGreaterThan(catalogDefinition.Id, 0); Expect.IsGreaterThan(catalogDefinition.Key, 0); }
public void CanAddItemToCatalog() { string itemName = "Test AddItem ".RandomLetters(6); CatalogService svc = _serviceRegistry.Get <CatalogService>(); CatalogDefinition catalog = svc.CreateCatalog(5.RandomLetters()); ItemDefinition item = svc.CreateItem(6.RandomLetters()); svc.AddItem(catalog.Cuid, item.Cuid); catalog = svc.GetCatalog(catalog.Cuid); Expect.IsTrue(catalog.Items.Select(i => i.Cuid.Equals(item.Cuid)).Count() == 1); }
public void CanRenameCatalog() { string catalogName = "Test Catalog To Find ".RandomLetters(10); string renamedName = "Renamed Test Catalog ".RandomLetters(10); CatalogService svc = _serviceRegistry.Get <CatalogService>(); CatalogDefinition catalog = svc.CreateCatalog(catalogName); Expect.AreEqual(catalogName, catalog.Name); svc.RenameCatalog(catalog.Cuid, renamedName); catalog = svc.GetCatalog(catalog.Cuid); Expect.AreEqual(renamedName, catalog.Name); }
public void CanDeleteItem() { string itemName = "Test RenameItem ".RandomLetters(8); string newName = "New Name ".RandomLetters(8); CatalogService svc = _serviceRegistry.Get <CatalogService>(); CatalogDefinition catalog = svc.CreateCatalog(5.RandomLetters()); ItemDefinition item = svc.CreateItem(itemName); svc.DeleteItem(item.Cuid); ItemDefinition shouldBeNull = svc.GetItem(item.Cuid); Expect.IsNull(shouldBeNull); }
public void CanGetItem() { string itemName = "Test RenameItem ".RandomLetters(8); string newName = "New Name ".RandomLetters(8); CatalogService svc = _serviceRegistry.Get <CatalogService>(); CatalogDefinition catalog = svc.CreateCatalog(5.RandomLetters()); ItemDefinition item = svc.CreateItem(itemName); ItemDefinition gotItem = svc.GetItem(item.Cuid); Expect.IsNotNull(gotItem); Expect.AreEqual(item.Cuid, gotItem.Cuid); Expect.AreEqual(item.Name, gotItem.Name); }
public void CanRenameCatalog() { CatalogService svc = GetTestCatalogService(nameof(CanRenameCatalog), out DaoRepository daoRepository); string testCatalogName = $"{nameof(CanRenameCatalog)}_TestCatalog"; string renamedName = $"{testCatalogName}_Renamed"; CatalogDefinition catalogDefinition = svc.CreateCatalog(testCatalogName); Expect.AreEqual(testCatalogName, catalogDefinition.Name); CatalogDefinition renamed = svc.RenameCatalog(catalogDefinition, renamedName); Expect.AreEqual(renamedName, renamed.Name); CatalogDefinition retrieved = svc.FindCatalog(renamedName); Expect.AreEqual(retrieved, renamed); }
public void CanRemoveItemFromCatalog() { string itemName = "Test AddItem ".RandomLetters(6); CatalogService svc = _serviceRegistry.Get <CatalogService>(); CatalogDefinition catalog = svc.CreateCatalog(5.RandomLetters()); ItemDefinition item = svc.CreateItem(6.RandomLetters()); svc.AddItem(catalog.Cuid, item.Cuid); catalog = svc.GetCatalog(catalog.Cuid); List <ItemDefinition> items = catalog.Items.Where(i => i.Cuid.Equals(item.Cuid)).ToList(); Expect.IsTrue(items.Count == 1, $"Expected 1 catalog item but there were {items.Count}"); svc.RemoveItem(catalog.Cuid, item.Cuid); catalog = svc.GetCatalog(catalog.Cuid); items = catalog.Items.Where(i => i.Cuid.Equals(item.Cuid)).ToList(); Expect.IsTrue(items.Count == 0, $"Expected 0 catalog items but there were {items.Count}"); }
public void ConsoleInvokableIntegrationTest() { ConsoleLogger logger = new ConsoleLogger(); logger.StartLoggingThread(); CoreClient client = new CoreClient("TestOr", "TestApp", "localhost", 9100, logger); CatalogService svc = client.GetProxy <CatalogService>(); CatalogDefinition list = svc.CreateCatalog("test list"); //ListDefinition CreateList(string name); //ItemDefinition CreateItem(string name); //ListDefinition AddItem(string listCuid, string itemCuid); //bool RemoveItem(string listCuid, string itemCuid); //ListDefinition GetList(string listCuid); //ListDefinition FindList(string name); //ListDefinition RenameList(string listCuid, string name); //ItemDefinition RenameItem(string itemCuid, string name); //bool DeleteList(string listCuid); //bool DeleteItem(string itemCuid); }
public void CanRenameItem() { string itemName = "Test RenameItem ".RandomLetters(8); string newName = "New Name ".RandomLetters(8); CatalogService svc = _serviceRegistry.Get <CatalogService>(); CatalogDefinition catalog = svc.CreateCatalog(5.RandomLetters()); ItemDefinition item = svc.CreateItem(itemName); svc.AddItem(catalog.Cuid, item.Cuid); catalog = svc.GetCatalog(catalog.Cuid); List <ItemDefinition> namedItems = catalog.Items.Where(i => i.Name.Equals(itemName)).ToList(); Expect.IsTrue(namedItems.Count == 1, $"expected 1 item in catalog but there were {namedItems.Count}"); svc.RenameItem(item.Cuid, newName); catalog = svc.GetCatalog(catalog.Cuid); List <ItemDefinition> oldNamedItems = catalog.Items.Where(i => i.Name.Equals(itemName)).ToList(); Expect.IsTrue(oldNamedItems.Count == 0); List <ItemDefinition> newNamedItems = catalog.Items.Where(i => i.Name.Equals(newName)).ToList(); Expect.IsTrue(newNamedItems.Count == 1, $"Expected 1 new item but there were {newNamedItems.Count}"); }