AutoFixture:你能解冻数据类型吗?
AutoFixture: Can you unfreeze a data type?
对象类型冻结后是否可以解冻?
所以如果我有一个使用 DateTime 的对象 Appointment,有没有办法做这样的事情?
var time = fixture.Freeze<DateTime>();
IEnumerable<ClientAppointment> appointments = fixture.CreateMany < ClientAppointment>();
fixture.Unfreeze<ClientAppointment>();
这样我就可以生成注入了不同 DateTime 的新对象?
在 AutoFixture 中没有解冻类型的记录、稳定的方法。
相反,更改创建对象的顺序,以便
var time = fixture.Freeze<DateTime>();
IEnumerable<ClientAppointment> appointments = fixture.CreateMany < ClientAppointment>();
是你做的最后一件事。
对象类型冻结后是否可以解冻?
所以如果我有一个使用 DateTime 的对象 Appointment,有没有办法做这样的事情?
var time = fixture.Freeze<DateTime>();
IEnumerable<ClientAppointment> appointments = fixture.CreateMany < ClientAppointment>();
fixture.Unfreeze<ClientAppointment>();
这样我就可以生成注入了不同 DateTime 的新对象?
在 AutoFixture 中没有解冻类型的记录、稳定的方法。
相反,更改创建对象的顺序,以便
var time = fixture.Freeze<DateTime>();
IEnumerable<ClientAppointment> appointments = fixture.CreateMany < ClientAppointment>();
是你做的最后一件事。