示例#1
0
 public void buildTests()
 {
     Assert.AreEqual(1, LinkedListsPushBuildOneTwoThree.BuildOneTwoThree().Data,
                     "First node should should have 1 as data.");
     Assert.AreEqual(2, LinkedListsPushBuildOneTwoThree.BuildOneTwoThree().Next.Data,
                     "Second node should should have 2 as data.");
     Assert.AreEqual(3, LinkedListsPushBuildOneTwoThree.BuildOneTwoThree().Next.Next.Data,
                     "Third node should should have 3 as data.");
     Assert.AreEqual(null, LinkedListsPushBuildOneTwoThree.BuildOneTwoThree().Next.Next.Next,
                     "Third node should be the tail of the linked list");
 }
示例#2
0
 public void pushTests()
 {
     Assert.AreEqual(1, LinkedListsPushBuildOneTwoThree.Push(null, 1).Data,
                     "Should be able to create a new linked list with push().");
     Assert.AreEqual(null, LinkedListsPushBuildOneTwoThree.Push(null, 1).Next,
                     "Should be able to create a new linked list with push().");
     Assert.AreEqual(2, LinkedListsPushBuildOneTwoThree.Push(new LinkedListsPushBuildOneTwoThree(1), 2).Data,
                     "Should be able to prepend a node to an existing node.");
     Assert.AreEqual(1,
                     LinkedListsPushBuildOneTwoThree.Push(new LinkedListsPushBuildOneTwoThree(1), 2).Next.Data,
                     "Should be able to prepend a node to an existing node.");
 }
示例#3
0
 public static LinkedListsPushBuildOneTwoThree Push(LinkedListsPushBuildOneTwoThree head, int data)
 {
     return(new LinkedListsPushBuildOneTwoThree(data, head));
 }
示例#4
0
 public LinkedListsPushBuildOneTwoThree(int data, LinkedListsPushBuildOneTwoThree next = null)
 {
     Data = data;
     Next = next;
 }