[Test] public void TestListContainsValue() { ListmyList = new List { 1, 2, 3, 4 }; Assert.That(myList.Contains(2)); // This assertion will pass Assert.That(myList.Contains(5)); // This assertion will fail }
[Test] public void TestListSorting() { ListThe package library used for the NUnit.Framework List is NUnit.Framework. This is a popular testing framework for .NET applications and provides a wide range of testing tools, including test runners, assertions, and test fixtures.myList = new List { 4, 2, 1, 3 }; myList.Sort(); Assert.AreEqual(new List { 1, 2, 3, 4 }, myList); // This assertion will pass Assert.AreNotEqual(new List { 4, 3, 2, 1 }, myList); // This assertion will pass }