相关疑难解决方法(0)

将多个可选参数传递给C#函数

有没有办法设置C#函数来接受任意数量的参数?例如,您是否可以设置一个功能,以便以下所有工作 -

x = AddUp(2, 3)

x = AddUp(5, 7, 8, 2)

x = AddUp(43, 545, 23, 656, 23, 64, 234, 44)
Run Code Online (Sandbox Code Playgroud)

c# parameters function

61
推荐指数
3
解决办法
8万
查看次数

在specflow中传递变量数组

有没有办法传递参数数组而不是单独传递每个参数?

例如,我有以下场景:

When i login to a site
then <firstname>, <lastname>, <middleName>, <Desingation>, <Street>, <Apartmentno> are valid
Run Code Online (Sandbox Code Playgroud)

列表可以在上面继续.相反,我可以在数组中传递所有上述变量吗?

arrays variables specflow

14
推荐指数
1
解决办法
8724
查看次数

为SpecFlow Scenario提供多个When语句

SpecFlow相当新,所以请耐心等待.

我正和一位同事一起基本了解你可以用SpecFlow做些什么.

我们使用了经典的FizzBu​​zz问题,我们用它来测试单元测试,以比较我们在SpecFlow中如何处理类似问题.

我们编写了我们的场景,如下所示增长代码:

(请原谅命名只是想获得测试令状)

Scenario: 1 is 1
    Given there is a FizzBuzzFactory
    When you ask What I Am with the value of 1
    Then the answer should be 1 on the screen

Scenario: 3 is Fizz
    Given there is a FizzBuzzFactory
    When you ask What I Am with the value of 3
    Then the answer should be Fizz on the screen

Scenario: 5 is Buzz
    Given there is a FizzBuzzFactory
    When you ask What I Am with the …
Run Code Online (Sandbox Code Playgroud)

c# params specflow

7
推荐指数
1
解决办法
2560
查看次数

标签 统计

c# ×2

specflow ×2

arrays ×1

function ×1

parameters ×1

params ×1

variables ×1