public void Test() { var set = new GraphSet <int>(); var node = set.Add(3); Check.That(set.IsCyclic()).IsFalse(); Check.That(node).IsNotNull(); Check.That(node.Value).IsEqualTo(3); var nodes = set.GetNodes().ToList(); Check.That(nodes.Count).IsEqualTo(1); Check.That(nodes.Select(x => x.Value).FirstOrDefault()).IsEqualTo(3); }
public void TestToGraphSet() { var set = new GraphSet <string>(); var three = set.Add("3"); var four = three.AddChild("4"); three.AddParent("2"); var two = three.AddParent("Two"); var one = two.AddParent("One"); two.AddParent("Un"); four.AddParent(one); var nodes = set.GetNodes(); Assert.Equal(6, nodes.Count()); Assert.False(set.IsCyclic()); }