You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a class with a child object property. The default constructor sets an empty object to avoid NULL errors further in my production code. When trying to configure GenFu, the child property is never filled, It just leaves the "empty" value set by the default constructor. How can I override that behavior? Can it be overridden?
Sample code:
[Test]
public void Test()
{
A.Configure<MyClass>()
.Fill(x => x.Child, () => A.New<MyChildClass>());
var obj = A.New<MyClass>();
obj.Child.Value.Should().NotBeNull();
}
public class MyClass
{
public MyChildClass Child { get; set; }
public MyClass()
{
Child = new MyChildClass();
}
}
public class MyChildClass
{
public string Value { get; set; }
}
The text was updated successfully, but these errors were encountered:
I have a class with a child object property. The default constructor sets an empty object to avoid NULL errors further in my production code. When trying to configure GenFu, the child property is never filled, It just leaves the "empty" value set by the default constructor. How can I override that behavior? Can it be overridden?
Sample code:
The text was updated successfully, but these errors were encountered: