[Test] public void TestListEquality() { Listlist1 = new List {1, 2, 3}; List list2 = new List {1, 2, 3}; Assert.IsTrue(list1.SequenceEqual(list2)); }
[Test] public void TestListInequality() { ListIn Example 1, two lists are created with the same elements in the same order. The SequenceEqual method is called on list1, and passed list2 as a parameter. Since the lists are the same, the test passes. In Example 2, two lists are created with the same elements but in a different order. The SequenceEqual method is called on list1 and passed list2 as a parameter. Since the lists are not the same, the test fails. This method is part of the NUnit.Framework package library.list1 = new List {1, 2, 3}; List list2 = new List {3, 2, 1}; Assert.IsFalse(list1.SequenceEqual(list2)); }