简体   繁体   English

过多的参数在NUnit中提供了错误

[英]Too many arguments provided error in NUnit

I have a NUnit test that should run with 11 params but, it gives me error when I am trying to debug. 我有一个应该使用11个参数运行的NUnit测试,但是,当我尝试调试时,它给了我错误。

Error : Too many arguments provided, provide at most 11 arguments. 错误 :提供的参数太多,最多提供11个参数。 I have tried to send these params as list in method but, it also couldn't work. 我试图将这些参数作为方法中的列表发送,但是它也无法正常工作。 What should i do ? 我该怎么办 ?

I changed my variable names because of the information security. 由于信息安全,我更改了变量名。

[Test]
    [TestCase("11111111111", "5355553355", 0, 0, 0, "1", "11111.11111", 0, "INTERNET", null, 1, "abc*@dfg")]
    public void FlowTestv2(string a, string b, decimal c, decimal d,
                                            decimal e, string f, string g, decimal h,
                                            string m, string j, string k)
    {
        FlowRequest(a, b, c, d,e, f, g, h, m, j, k);

        Assert.AreEqual(LimitInfo.ErrorMessage, "EndPointMethodNotFound:GetInfo");
    }

In your Code Example the method's signature has 11 parameters but your [TestCase] has 12 defined. 在您的代码示例中,方法的签名具有11个参数,但您的[TestCase]具有12个定义的参数。 One too much. 太多了


For each attempt to run a test you have to define a own Attribute as exampled in the documentation . 对于每次运行测试的尝试,您都必须定义一个自己的属性,如文档中所示

[TestCase(12,3,4)]
[TestCase(12,2,6)]
[TestCase(12,4,3)]
public void DivideTest(int n, int d, int q)
{
  Assert.AreEqual( q, n / d );
}

But every TestCase must match the method's signature. 但是每个TestCase必须匹配方法的签名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM