New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AutoFixture silently totally ignores ObservableCollection properties (sample code inside) #191
Comments
Currently there is no support for Here is how you can manually configure AutoFixture to fill collections of type fixture.Customizations.Add(
new FilteringSpecimenBuilder(
new MethodInvoker(
new EnumerableFavoringConstructorQuery()),
new ObservableCollectionSpecification())); The internal class ObservableCollectionSpecification : IRequestSpecification
{
public bool IsSatisfiedBy(object request)
{
var type = request as Type;
if (type == null)
return false;
return type.IsGenericType
&& typeof(ObservableCollection<>) == type.GetGenericTypeDefinition();
}
} |
Thanks for the sample. I'll try it tomorrow. |
No, not that I can think of. Actually it sounds like a good idea to add support for
|
Did the provided sample work for you? |
Yes. It did indeed work. Thanks again. |
AutoFixture now officially supports That means when you update to AutoFixture 3.11.0 your original test will work out of the box :) |
I am on 3.10.1 and my first contact with AutoFixture just failed :/
Does AF has issues with ObservableCollections?
Following class is created but the ObservableCollection is empty whereas the List is populated just fine:
Result is 3 entries in Lists but 0 in Observables.
I've also tried Build().Do(x => f.AddMany(...));
The text was updated successfully, but these errors were encountered: