< Summary

Information
Class: AmbientServices.Utilities.TaskUtilities
Assembly: AmbientServices
File(s): /home/runner/work/AmbientServices/AmbientServices/AmbientServices/Utilities/TaskUtilities.cs
Tag: 332_35464845198
Line coverage
100%
Covered lines: 1
Uncovered lines: 0
Coverable lines: 1
Total lines: 38
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ValueTaskFromResult<T>(...)100%11100%

File(s)

/home/runner/work/AmbientServices/AmbientServices/AmbientServices/Utilities/TaskUtilities.cs

#LineLine coverage
 1using System.Threading.Tasks;
 2
 3namespace AmbientServices.Utilities;
 4
 5/// <summary>
 6/// A static class that contains extensions for <see cref="Task"/>.
 7/// </summary>
 8/// <remarks>
 9/// <pitch>A <see cref="ValueTask{TResult}"/>-from-value shim: the equivalent of <c>ValueTask.FromResult</c> on target f
 10/// </remarks>
 11public static class TaskUtilities
 12{
 13#if NET5_0_OR_GREATER
 14    /// <summary>
 15    /// Gets a <see cref="ValueTask{TResult}"/> from the specified value.
 16    /// </summary>
 17    /// <typeparam name="T">The type contained within the ValueTask.</typeparam>
 18    /// <param name="value">The value to encapsulate into the ValueTask.</param>
 19    /// <returns>A <see cref="ValueTask{TResult}"/> containing the specified result value.</returns>
 20    public static ValueTask<T> ValueTaskFromResult<T>(T value)
 21    {
 222        return ValueTask.FromResult(value);
 23    }
 24#else
 25#pragma warning disable CS1998
 26    /// <summary>
 27    /// Gets a <see cref="ValueTask{TResult}"/> from the specified value.
 28    /// </summary>
 29    /// <typeparam name="T">The type contained within the ValueTask.</typeparam>
 30    /// <param name="value">The value to encapsulate into the ValueTask.</param>
 31    /// <returns>A <see cref="ValueTask{TResult}"/> containing the specified result value.</returns>
 32    public static async ValueTask<T> ValueTaskFromResult<T>(T value)
 33    {
 34        return value;
 35    }
 36#pragma warning restore CS1998
 37#endif
 38}

Methods/Properties

ValueTaskFromResult<T>(T)