【发布时间】:2014-05-21 16:00:50
【问题描述】:
我希望 AutoFixture 使用示例对象创建对象列表。
public class Person
{
public string Name { get; set; }
public int Age { get; set; }
}
var examplePerson = new Person { Name = "Test", Age = 34 };
var persons = fixture.CreateMany<Person>();
我想要的约定:
- 创建最大字符串。提供的字符串长度的长度(本例中为 4)
- 在最大值处创建整数。计算的位数等于提供的位数
- 使用小数点 14.99 创建类似的小数点,如 93.12
- 等等
所以我希望 AutoFixture 从我给定的示例对象中学习。
这可能吗:)?
【问题讨论】:
-
您所描述的可能是可能的,但它可能会导致难以编写的单元测试。请先考虑3rd paragraph from here。
标签: c# autofixture test-data