public void When_NonEmptyLinkedList_has_single_item_Then_Tail_returns_None()
        {
            var firstItem = TestingUtilities.Random.Next();

            var list = new NonEmptyLinkedList<int>(firstItem);

            Assert.That(list.Tail.HasValue, Is.False);
        }
        public void When_NonEmptyLinkedList_has_single_item_Then_IsLast_returns_true()
        {
            var singleItem = TestingUtilities.Random.Next();

            var list = new NonEmptyLinkedList<int>(singleItem);

            Assert.That(list.IsLast, Is.True);
        }
        public void When_NonEmptyLinkedList_has_single_item_Then_Head_returns_that_item()
        {
            var singleItem = TestingUtilities.Random.Next();

            var list = new NonEmptyLinkedList<int>(singleItem);

            Assert.That(list.Head, Is.EqualTo(singleItem));
        }
        public void When_NonEmptyLinkedList_has_two_items_Then_Tail_returns_Some()
        {
            var firstItem = TestingUtilities.Random.Next();
            var secondItem = TestingUtilities.Random.Next();

            var list = new NonEmptyLinkedList<int>(firstItem, new NonEmptyLinkedList<int>(secondItem));

            Assert.That(list.Tail.HasValue, Is.True);
        }
        public void When_NonEmptyLinkedList_has_multiple_items_Then_IsLast_returns_false()
        {
            var firstItem = TestingUtilities.Random.Next();
            var secondItem = TestingUtilities.Random.Next();

            var list = new NonEmptyLinkedList<int>(firstItem, new NonEmptyLinkedList<int>(secondItem));

            Assert.That(list.IsLast, Is.False);
        }
        public void When_NonEmptyLinkedList_has_multiple_items_Then_items_can_be_enumerated()
        {
            var firstItem = TestingUtilities.Random.Next();
            var secondItem = TestingUtilities.Random.Next();

            var list = new NonEmptyLinkedList<int>(firstItem, new NonEmptyLinkedList<int>(secondItem));
            var expected = (IEnumerable<int>) new[] { firstItem, secondItem };
            var actual = new List<int>();

            foreach (var item in list)
                actual.Add(item);

            Assert.That(actual, Is.EquivalentTo(expected));
        }