When a trivial exit condition occurs in the intermediate method GetUserCourseStatusAsync
and a Task<T>
is expected, a dummy Task<T>
should be returned instead of null
. The following code can be used to return a dummy Task<T>
:
// Trivial return of dummy task ("User not registered")
return Task.FromResult<IGetUserCourseResponse>(null);
It is important to note that returning null
when a trivial exit condition occurs may be an anti-pattern and should be reconsidered.