How do I put new List<int> {1} in an NUNIT TestCase?
问题 I have the method: public static int Add(List<int> numbers) { if (numbers == null || numbers.Count == 0) return 0; if (numbers.Count == 1) return numbers[0]; throw new NotImplementedException(); } Here is my test against it, but it does not like new List<int> {1} in the TestCase: [TestCase(new List<int>{1}, 1)] public void Add_WithOneNumber_ReturnsNumber(List<int> numbers) { var result = CalculatorLibrary.CalculatorFunctions.Add(numbers); Assert.AreEqual(1, result); } It gives me the error: