循环引用对象创建抛出NullReferenceException

时间:2016-04-14 16:39:45

标签: c# autofixture

我正在尝试创建一个代表星型模式数据库中事实表的DbSet。这是AutoFixture抛出NullReferenceException

的简化示例
public class FctAssumption
{
    public virtual DimAssumption DimAssumption { get; set; }
}

public class DimAssumption
{
    public int Id { get; set; }
    public virtual ICollection<FctAssumption> FctAssumptions { get; set; }
}

public class Class1
{
    public static void Main()
    {
        var fixture = new Fixture();
        var fake = fixture.Build<FctAssumption>()
            .Without(x => x.DimAssumption.FctAssumptions)
            .Create();
    }
}

是否可以使用AutoFixture创建FctAssumption?

0 个答案:

没有答案