问题描述
我评估和我有点卡住了。结果
我发现所有样本我大量工作基本上是与简单的对象。
I'm evaluating SpecFlow and I'm a bit stuck.
All samples I have found are basically with simple objects.
项目依赖于一个复杂的对象。密切样本可能是这个对象:
Project I'm working on heavily relies on a complex object. A close sample could be this object:
public class MyObject
{
public int Id { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public IList<ChildObject> Children { get; set; }
}
public class ChildObject
{
public int Id { get; set; }
public string Name { get; set; }
public int Length { get; set; }
}
没有人有任何想法怎么会写我的功能/场景,其中为MyObject
会从一个给定的步骤进行实例化,并在当和那么的步骤?
Does anyone have any idea how could a write my features/scenarios where MyObject
would be instantiated from a "Given" step and used in "When" and "Then" steps?
由于使用提前
编辑:就在心中拍:支持嵌套表
Just a shot in mind: are nested tables supported?
推荐答案
有关的例子,你已经证明我想说。这个例子看起来更适合写与NUnit的,可能使用的 的。与specflow或类似工具笔试应该是面对客户,并使用相同的语言作为你的客户会用来描述该功能。
For the example you have shown I would say you're cuking it wrong. This example looks more suitable to write with nunit and probably using an object mother. Tests written with specflow or similar tool should be customer facing and use the same language as your customer would use to describe the feature.
这篇关于SpecFlow和复杂的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!