Unit testing Microsoft Moles:循环参考错误?

Unit testing Microsoft Moles:循环参考错误?,unit-testing,moles,stub,circular-reference,Unit Testing,Moles,Stub,Circular Reference,我有以下实体框架实体: public class Country { public long Id { get; set; } public string Code { get; set; } public virtual ICollection<Person> Persons { get; set; } } public class Person { public long Id { get; set; } public long? Cou

我有以下实体框架实体:

public class Country
{
    public long Id { get; set; }
    public string Code { get; set; }
    public virtual ICollection<Person> Persons { get; set; }
}

public class Person
{
    public long Id { get; set; }
    public long? Country_Id { get; set; }
    public Country HomeCountry { get; set; }
}
答案是:

MolesContext.ExecuteWithoutMoles(() => instance.Country_Id = id);
MolesContext.ExecuteWithoutMoles(() => instance.Country_Id = id);