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
Maybe I just don't know how to do it, but for me it seems that it is right now not possible to verify return parameters of a method, if that method is async, so actually return a Task<TReturn> where there Return is what you actually want to check.
It would be great if this would be added or a hint how this could be accomplished!
Great framework by the way!
The text was updated successfully, but these errors were encountered:
protectedreadonlyIEnumerable<System.Type>AwaitableTypes=[typeof(Task),typeof(Task<>),typeof(ValueTask),typeof(ValueTask<>)];/// <summary>/// Methods returning <see cref="Task"/>, <see cref="Task{TResult}"/>, <see cref="ValueTask"/>, <see cref="ValueTask{TResult}"/>/// should have names that end with "Async"./// <see href="https://learn.microsoft.com/en-us/dotnet/csharp/asynchronous-programming/task-asynchronous-programming-model#BKMK_NamingConvention">Naming Convention for Async Methods</see>/// </summary>[Fact]publicvoidMethods_ThatReturnAwaitableTypes_ShouldHaveAsyncSuffix(){varrule=MethodMembers().That().HaveReturnType(AwaitableTypes).Should().HaveNameContaining("Async(");rule.Check(Architecture);}
I wanted to use .HaveNameEndingWith("Async");, but I think that might be checking the method name, plus arguments. For instance ExecuteAsync(bool something) is flagging up as a failure. Though with .HaveNameContaining("Async("); it passes.
Maybe I just don't know how to do it, but for me it seems that it is right now not possible to verify return parameters of a method, if that method is async, so actually return a
Task<TReturn>
where there Return is what you actually want to check.It would be great if this would be added or a hint how this could be accomplished!
Great framework by the way!
The text was updated successfully, but these errors were encountered: