FsCheck
FsCheck copied to clipboard
How to use Collect from async test (C#)
I'm unable to return a Property from async tests. I'm not sure if the issue is more or less a missing overload in the api or if things are more complicated. Is there a way to use Collect from an async test (both assertion and bool style)?
// Assertion style
[Property]
public Property Test_async_function2() {
return Prop.ForAll<DoNotSize<int>>(async i => {
await Task.Delay(10);
Assert.True(i.Item is int);
// return true.Collect(i); // will not compile
});
}
// Bool style
[Property]
public Property Test_async_function6() {
return Prop.ForAll<DoNotSize<int>>(async i => {
await Task.Delay(10);
// return (i.Item is int).Collect(i.Item); // will not compile
});
}
As an aside, I believe I had to update to v3 to get async tests to work and I notice a C# record
s fix recently landed. Will there be a v3 beta update soon? Is there a thread to track progress on when v3 will be released?
hmm, looks like a Task<Property>
overload is missing for ForAll
.