Listnumbers = new List { 1, 2, 3, 4, 5 }; Assert.That(numbers, Has.Some.EqualTo(3));
ListThis code checks if the list contains any element that contains the string "Jack" using the Has.None.Contains method. If it doesn't, the test passes, otherwise it fails. Package library: NUnit.Framework (you can install it via NuGet package manager)names = new List { "John", "Jane", "Jim" }; Assert.That(names, Has.None.Contains("Jack"));