예제 #1
0
        public void SearchShouldReturnNullWhenNotFound()
        {
            int[] array = new int[] { 12, 15, -61, 0, 5 };
            SingleLinkedNode <int> actual = SingleLinkedNode <int> .CreateFromArray(array);

            Assert.IsNull(actual.Search(38129), "Should return null");
        }
예제 #2
0
        public void SearchShouldReturnNodeWhenValueFound()
        {
            int[] array = new int[] { 12, 15, -61, 0, 5 };
            SingleLinkedNode <int> actual = SingleLinkedNode <int> .CreateFromArray(array);

            SingleLinkedNode <int> result = actual.Search(15);

            Assert.IsNotNull(result, "Should not return null");
            Assert.AreEqual(15, result.Value, "Value");
            Assert.AreEqual(-61, result.Next.Value, "Next value");
        }