ListmyNumbers = new List { 1, 2, 3, 4, 5 }; Assert.IsTrue(myNumbers.All(number => number > 0));
ListHere, we use the `Contains()` method of the List Is class to test that the list contains the string "banana". The `IsTrue()` method again validates that the condition is met. The package library for Microsoft.VisualStudio.TestTools.UnitTesting is part of the .NET Framework and is included in Visual Studio.myStrings = new List { "apple", "banana", "orange" }; Assert.IsTrue(myStrings.Contains("banana"));