How do I put new List {1} in an NUNIT TestCase?

后端 未结 8 1888
后悔当初
后悔当初 2020-12-13 13:12

I have the method:

public static int Add(List numbers)
    {
        if (numbers == null || numbers.Count == 0)
            return 0;

        if          


        
8条回答
  •  一向
    一向 (楼主)
    2020-12-13 13:43

    Just create the list inside the method instead, like this:

    public void Add_WithOneNumber_ReturnsNumber()
    {
        var result = CalculatorLibrary.CalculatorFunctions.Add(new List{1});
    
        Assert.AreEqual(1, result);
    }
    

提交回复
热议问题