使用GenFu填充可空的属性

时间:2018-02-16 08:55:06

标签: c# mocking

我有一个这样的课程:

public class Thing
{
    public int? Id { get; set; }
    public string Description { get; set; }
    public DateTime? Timestamp { get; set; }
}

我的配置如下:

A.Configure<Thing>()
    .Fill(x => x.Id)
    .Fill(x => x.Timestamp);

但是当我创建一个包含var things = A.ListOf<Thing>(50);的列表时,所有这些列表都将Id和Timestamp设为null

(我在.NET framework 4.6.2项目中使用它)

我缺少什么?如何强制填充可空属性?

0 个答案:

没有答案
相关问题