コード例 #1
0
        public void a_single_node_can_point_to_itself()
        {
            var node = new LinkListNode<string>("node");
            node.AddNext(node);

            node.Next.ShouldBe(node);
        }
コード例 #2
0
        public void a_node_that_points_to_itself_is_cyclic()
        {
            var node = new LinkListNode<string>("node");

            node.AddNext(node);

            node.IsCyclic().ShouldBe(true);
        }
コード例 #3
0
        public void node_can_point_to_the_next_node()
        {
            var first = new LinkListNode<string>("first");
            var second = new LinkListNode<string>("second");
            first.AddNext(second);

            first.Next.ShouldBe(second);
        }
コード例 #4
0
        public void two_nodes_can_have_circular_pointers()
        {
            var first = new LinkListNode<string>("first");
            var second = new LinkListNode<string>("second");
            first.AddNext(second)
                .AddNext(first);

            first.Next.Next.ShouldBe(first);
            second.Next.Next.ShouldBe(second);
        }
コード例 #5
0
        public void chain_of_nodes_can_point_to_an_inner_node()
        {
            var first = new LinkListNode<string>("first");
            var second = new LinkListNode<string>("second");
            var third = new LinkListNode<string>("third");

            first.AddNext(second)
                .AddNext(third)
                .AddNext(second);

            first.Next.Next.Next.ShouldBe(second);
        }
コード例 #6
0
 public void can_add_next_by_value()
 {
     var node = new LinkListNode<string>("first");
     node.AddNext("second");
 }