public void CraftTreePath_WhenAddingNodeToRoot_NoStepsGiven(string path, string id) { var cPath = new CraftTreePath(path, id); Assert.IsNull(cPath.StepsToParentTab); Assert.IsTrue(cPath.IsAtRoot); }
public override bool SendToSMLHelper() { QuickLogger.Debug($"CraftingNodePath for {this.Key} '{this.TabID}' set to {this.ParentTabPath}"); try { if (this.IsAtRoot) { this.ParentFabricator.RootNode.AddTabNode(this.TabID, this.DisplayName, GetCraftingTabSprite()); } else { CraftTreePath craftTreePath = GetCraftTreePath(); if (craftTreePath.HasError) { QuickLogger.Error($"Encountered error in path for '{this.TabID}' - Entry from {this.Origin} - Error Message: {this.CraftingPath.Error}"); return(false); } ModCraftTreeTab otherTab = this.ParentFabricator.RootNode.GetTabNode(craftTreePath.StepsToParentTab); otherTab.AddTabNode(this.TabID, this.DisplayName, GetCraftingTabSprite()); } return(true); } catch (Exception ex) { QuickLogger.Error($"Exception thrown while handling {this.Key} '{this.TabID}' from {this.Origin}", ex); return(false); } }
public void CraftTreePath_WhenRemovingNode_CheckPathForRemoval(string path, string id, int expectedStepCount) { var cPath = new CraftTreePath(path, id); string[] stepsToNode = cPath.StepsToNode; Assert.AreEqual(expectedStepCount, stepsToNode.Length); Assert.AreEqual(id, stepsToNode[expectedStepCount - 1]); }
public void CraftTreePath_WhenAddingNodeNotAtRoot_CheckPathForAddition(string path, string id, int expectedStepCount) { var cPath = new CraftTreePath(path, id); string[] stepsToParent = cPath.StepsToParentTab; Assert.AreEqual(expectedStepCount, stepsToParent.Length); Assert.AreNotEqual(id, stepsToParent[expectedStepCount - 1]); Assert.IsFalse(cPath.IsAtRoot); }
public void CraftTreePath_GivenPathAndNode_GetExpectedIsAtRoot(string path, string id, bool shouldBeRoot) { var cPath = new CraftTreePath(path, id); Assert.AreEqual(shouldBeRoot, cPath.IsAtRoot); }
public void CraftTreePath_GivenPathAndNode_GetExpectedScheme(string path, string id, CraftTree.Type expectedScheme) { var cPath = new CraftTreePath(path, id); Assert.AreEqual(expectedScheme, cPath.Scheme); }