C# 将SpecFlow功能步骤与字符串内的双引号匹配
我有一个台阶C# 将SpecFlow功能步骤与字符串内的双引号匹配,c#,specflow,C#,Specflow,我有一个台阶 Then I must see the 3 text text text "Text" as one of the search results 和步骤定义 [Then(@"I must see the (.*) as one of the search results")] 无论我将哪些符号添加到步骤定义中的regex“,” "3 text text text \"Text\"" 在本例中,我不
Then I must see the 3 text text text "Text" as one of the search results
和步骤定义
[Then(@"I must see the (.*) as one of the search results")]
无论我将哪些符号添加到步骤定义中的regex“
,”
"3 text text text \"Text\""
在本例中,我不想转义引号,而是在一个步骤中获取预定义数据的精确匹配
在这种情况下,我不想逃避引用,而是想抓住确切的答案
步骤中预定义数据的匹配
我相信您正在寻找精确匹配的引号
小黄瓜会
Then I must see below text as one of the search results
"""
3 text text text "Text"
"""
[Then(@"I must see below text as one of the search results")]
public void docStringOnlyTest(string docString)
{
log.Info(docString);
}
步骤定义是
Then I must see below text as one of the search results
"""
3 text text text "Text"
"""
[Then(@"I must see below text as one of the search results")]
public void docStringOnlyTest(string docString)
{
log.Info(docString);
}
这将在控制台上记录3 text“text”
文档字符串被捕获为步骤定义中的最后一个参数,并由三个引号定义。将结果打印到控制台或在调试器中时,您会看到转义引号吗?@Jawad我在调试器中时会看到转义引号。我的断言在此之后失败。因为我希望与预定义输入完全匹配。请将您的问题也包括步骤定义的代码。谢谢您的建议。如果我上面提到的一个步骤在一个场景中呢?这种方法仍然有效吗?是的,它像预期的那样有效。非常感谢。