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

后端 未结 8 1902
后悔当初
后悔当初 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:27

    Improve code for @Yurii Hohan answer:

    private  static readonly object[] _Data =
            {
                new object[] {new List {0}, "test"},
                new object[] {new List {0, 5}, "test this"},
            };
    
    [Test, TestCaseSource(nameof(_Data))]
    

    Hope this help.

提交回复
热议问题