public void TestOneEdgeWeight()
        {
            var root     = new IntWeightedNode(0);
            var neighbor = new IntWeightedNode(2);

            root.AddDirectedEdge(neighbor, 10);
            Assert.AreEqual(10, root.Cost(neighbor));
        }
        public void TestAPI()
        {
            var root = new IntWeightedNode(42);

            Assert.AreEqual(42, root.Content);
            Assert.AreEqual(0, root.NeighborsCount);
            Assert.IsNull(root.Find(42));
            Assert.IsFalse(root.HasNeighbor(root));

            var neighbor = new IntWeightedNode(21);

            root.AddDirectedEdge(neighbor, 100);
            Assert.AreEqual(1, root.NeighborsCount);

            Assert.AreEqual(100, root.Cost(neighbor));
            Assert.IsTrue(root.HasNeighbor(neighbor));

            var found = root.Find(21);

            Assert.AreSame(found, neighbor);

            var neighborsAndWeights = ">";

            root.ForEachNeighborAndCost(pair =>
            {
                neighborsAndWeights +=
                    $" {(pair.Key as IntWeightedNode).Content.ToString()}" +
                    $":{pair.Value.ToString()}";
            });
            Assert.AreEqual("> 21:100", neighborsAndWeights);

            var neighbors = ">";

            root.ForEachNeighbor((node) =>
            {
                neighbors += $" {(node as IntWeightedNode).Content.ToString()}";
            });
            Assert.AreEqual("> 21", neighbors);

            root.RemoveDirectedEdge(neighbor);
            Assert.AreEqual(0, root.NeighborsCount);
            Assert.IsFalse(root.HasNeighbor(neighbor));
            Assert.IsNull(root.Find(21));
        }