-
Notifications
You must be signed in to change notification settings - Fork 30
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
Can .CheckAsync
exist in C# world?
#449
Comments
Is there a better way of writing it than this? public static Task CheckAsync(this Property<Task> property)
{
property
.Select(x => x.GetAwaiter().GetResult())
.Check();
return Task.CompletedTask;
}
public static Task CheckAsync(this Property<Task<bool>> property)
{
property
.Select(x => x.GetAwaiter().GetResult())
.Check();
return Task.CompletedTask;
} I don't like it, but I saw that If we are settling on this approach, can these methods be added to the library please? |
What are you property testing that involves |
Many things. Many interfaces now provide only async API to accommodate different backends. My line of work stuff includes Cache, Outbox and Producer interfaces. Using testing harness with async API, for example, HotChocolate GraphQL executors: register types, generate the query, see that it is understood and parsed by HotChocolate correctly and into correct values. That has an async API. I also use property based testing for integration tests from time to time, very handy, too. Like, make an API call, make sure that a correct message is published to a Kafka topic and that the schema is registered in the registry, but only once per schema. Or testing projectors: giving it a generated message and then asserting that it was projected in an expected format at the expecting place... There are many scenarios. And I don't think that conceptually not supporting testing async functions would have a good justification. Granted being able to sequence |
I stumbled upon a need to test an
async
action in C#, like:It'd be great to be able to run this property with something like
.CheckAsync()
The text was updated successfully, but these errors were encountered: