我很难弄清楚我在 VS2012 和/或 VS2010 中的规范流程功能出了什么问题
如果该字符包含在步骤表达式中的其他任何位置,我根本无法在步骤中使用单个字符作为参数
它永远无法正确解析,我尝试过各种方法,包括使用引号等,但似乎无法使用单个字符。
请有人确认这是预期的或已知的问题,甚至我只是做错了什么?
我尝试过使用 SpecFlow 1.9.1 和 1.9.2(最新版本),但都不起作用。
显示我的问题的一个简单示例是以下功能/步骤
特征
Feature: Test1
In order to check the id of an object using a character
As a frustrated developer
I want to define a step with a single char as a parameter
@mytag
Scenario: Test single char param of character existing in phrase
Given I have an array of 8 characters
Then the array should contain the character a
Scenario: Test single char param of character not existing in phrase
Given I have an array of 8 characters
Then the array should contain the character z
脚步
public class TestSpecFlow1Steps
{
char[] charArray = new char[] { 'a', 'b', 'c', 'd', 'e', 'x', 'y', 'z' };
[Given(@"I have an array of (.*) characters")]
public void CheckArrayCount(int arrayCount)
{
Assert.AreEqual(charArray.Length, arrayCount);
}
[Then(@"the array should contain the character (.*)")]
public void CheckCharaExists(char val)
{
Assert.AreEqual(true, charArray.Contains(val));
}
}
对此的任何帮助将不胜感激。
谢谢