public DeleteEntityCategoryFixture(OsdrWebTestHarness harness) { var categories = new List <TreeNode>() { new TreeNode("Category Root", new List <TreeNode>() { new TreeNode("My Test Category"), new TreeNode("Projects Two") }) }; var response = harness.JohnApi.PostData("api/categorytrees/tree", categories).Result; var content = response.Content.ReadAsStringAsync().Result; RootCategoryId = Guid.Parse(content); harness.WaitWhileCategoryTreePersisted(RootCategoryId); BlobId = harness.JohnBlobStorageClient.AddResource(harness.JohnId.ToString(), "Chemical-diagram.png", new Dictionary <string, object>() { { "parentId", harness.JohnId } }).Result; FileId = harness.WaitWhileFileProcessed(BlobId); }
public UpdateCategoryTreeViaPatchFixture(OsdrWebTestHarness harness) { var categories = new List <TreeNode>() { new TreeNode("Projects", new List <TreeNode>() { new TreeNode("Projects One"), new TreeNode("Projects Two") }) }; var response = harness.JohnApi.PostData("/api/categorytrees/tree", categories).Result; var content = response.Content.ReadAsStringAsync().Result; CategoryId = Guid.Parse(content); harness.WaitWhileCategoryTreePersisted(CategoryId); var nodeIds = GetNodeIdsForCategory(harness, CategoryId).Result.ToList(); var guidOne = nodeIds.ElementAt(0); var guidTwo = nodeIds.ElementAt(1); var guidThree = nodeIds.ElementAt(2); var json = $@"[ {{ 'id': '{guidOne}', 'title': 'Level 0: Main Node 1', 'children': [ {{ 'id': '{guidTwo}', 'title': 'Level 1: Node 1', 'children': null }}, {{ 'id': '{guidThree}', 'title': 'Level 1: Node 2', 'children': null }} ] }}, {{ 'title': 'NoNameNode' }}, {{ 'title': '1' }}, {{ 'title': '2' }}, {{ 'title': '3' }}, {{ 'title': '4', 'children': [{{ 'title': '4-1' }}, {{ 'title': '4-2', 'children': [{{ 'title': '4-2-1' }}] }}] }} ]"; var url = $"/api/categorytrees/tree/{CategoryId}"; var data = $"[{{'op':'replace','path':'nodes','value': {json} }}]"; response = harness.JohnApi.PatchData(url, data).Result; harness.WaitWhileCategoryTreeUpdatedPersisted(CategoryId); }
public UpdateCategoryTreeFixture(OsdrWebTestHarness harness) { var categories = new List <TreeNode>() { new TreeNode("Projects", new List <TreeNode>() { new TreeNode("Projects One"), new TreeNode("Projects Two") }) }; var response = harness.JohnApi.PostData("/api/categorytrees/tree", categories).Result; var content = response.Content.ReadAsStringAsync().Result; CategoryId = Guid.Parse(content); harness.WaitWhileCategoryTreePersisted(CategoryId); var nodeIds = GetNodeIdsForCategory(harness, CategoryId).Result.ToList(); var guidOne = nodeIds.ElementAt(0); var guidTwo = nodeIds.ElementAt(1); var guidThree = nodeIds.ElementAt(2); var json = $@"[ {{ 'id': '{guidOne}', 'title': 'Level 0: Main Node 1', 'children': [ {{ 'id': '{guidTwo}', 'title': 'Level 1: Node 1', 'children': null }}, {{ 'id': '{guidThree}', 'title': 'Level 1: Node 2', 'children': null }} ] }}, {{ 'title': 'NoNameNode' }}, {{ 'title': '1' }}, {{ 'title': '2' }}, {{ 'title': '3' }}, {{ 'title': '4', 'children': [{{ 'title': '4-1' }}, {{ 'title': '4-2', 'children': [{{ 'title': '4-2-1' }}] }}] }} ]"; categories = JsonConvert.DeserializeObject <List <TreeNode> >(json); response = harness.JohnApi.PutData($"/api/categorytrees/tree/{CategoryId}", categories).Result; harness.WaitWhileCategoryTreeUpdatedPersisted(CategoryId); }
public CreateAndGetCategoryTreeFixture(OsdrWebTestHarness harness) { var categories = new List <TreeNode>() { new TreeNode("Projects", new List <TreeNode>() { new TreeNode("Projects One"), new TreeNode("Projects Two") }) }; var response = harness.JohnApi.PostData("/api/categorytrees/tree", categories).Result; var content = response.Content.ReadAsStringAsync().Result; CategoryId = Guid.Parse(content); harness.WaitWhileCategoryTreePersisted(CategoryId); }
public AddEntityCategoriesFixture(OsdrWebTestHarness harness) { var categories = new List <TreeNode>() { new TreeNode("Category Root", new List <TreeNode>() { new TreeNode("My Test Category"), new TreeNode("Projects Two") }) }; var response = harness.JohnApi.PostData("api/categorytrees/tree", categories).Result; var content = response.Content.ReadAsStringAsync().Result; CategoryId = Guid.Parse(content); harness.WaitWhileCategoryTreePersisted(CategoryId); BlobId = harness.JohnBlobStorageClient.AddResource(harness.JohnId.ToString(), "Chemical-diagram.png", new Dictionary <string, object>() { { "parentId", harness.JohnId } }).Result; FileId = harness.WaitWhileFileProcessed(BlobId); var fileNodeResponse = harness.JohnApi.GetNodeById(FileId).Result; var fileNode = JsonConvert.DeserializeObject <JObject>(fileNodeResponse.Content.ReadAsStringAsync().Result); FileNodeId = Guid.Parse(fileNode.Value <string>("id")); // add category to entity response = harness.JohnApi.PostData($"/api/categoryentities/entities/{FileNodeId}/categories", new List <Guid> { CategoryId }).Result; response.EnsureSuccessStatusCode(); harness.WaitWhileCategoryIndexed(CategoryId.ToString()); }