public void GetExactNodeSecondNode() { var subject = new MetadataIndex(); var path = new NodePath("Lang1", new NodePathLevel[] { new NodePathLevel("Level1", null), new NodePathLevel("Level2", null), }); var result1 = subject.AllocateNode(path); var path2 = new NodePath("Lang1", new NodePathLevel[] { new NodePathLevel("Level1", null), new NodePathLevel("Level2", null), new NodePathLevel("Level3", null), new NodePathLevel("Level4", null), }); var result2 = subject.AllocateNode(path2); var result = subject.GetExactNode(path2, true); result.Should().Be(result2); }
public void GetExactNodeParent(bool orParent, bool resultShouldBeNull) { var subject = new MetadataIndex(); var path = new NodePath("Lang1", new NodePathLevel[] { new NodePathLevel("Level1", null), new NodePathLevel("Level2", null), }); var result1 = subject.AllocateNode(path); var path2 = new NodePath("Lang1", new NodePathLevel[] { new NodePathLevel("Level1", null), new NodePathLevel("Level2", null), new NodePathLevel("Level3", null), new NodePathLevel("Level4", null), }); var result2 = subject.AllocateNode(path2); var path3 = new NodePath("Lang1", new NodePathLevel[] { new NodePathLevel("Level1", null), new NodePathLevel("Level2", null), new NodePathLevel("Level3", null), }); var result = subject.GetExactNode(path3, orParent); if (!resultShouldBeNull) { result.Should().Be(result1); } else { result.Should().BeNull(); } }