diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/DevServer.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/DevServer.cs
index 3625203..37bbe4a 100644
--- a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/DevServer.cs
+++ b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/DevServer.cs
@@ -5,23 +5,6 @@
#pragma warning disable
#endif
#pragma warning disable CA1848 // Log perf
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Net;
-using System.Net.Sockets;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.Extensions.Logging;
-using Uno.Extensions;
-using Uno.UI.RuntimeTests.Engine;
-
namespace Uno.UI.RuntimeTests.Internal.Helpers;
///
@@ -31,9 +14,9 @@ namespace Uno.UI.RuntimeTests.Internal.Helpers;
/// This class is intended to be used only by the the test engine itself and should not be used by applications.
/// API contract is not guaranteed and might change in future releases.
///
-internal sealed partial class DevServer : IAsyncDisposable
+internal sealed partial class DevServer : global::System.IAsyncDisposable
{
- private static readonly ILogger _log = typeof(DevServer).Log();
+ private static readonly global::Microsoft.Extensions.Logging.ILogger _log = global::Uno.Extensions.LogExtensionPoint.Log(typeof(DevServer));
private static int _instance;
private static string? _devServerPath;
@@ -42,7 +25,7 @@ internal sealed partial class DevServer : IAsyncDisposable
///
/// Cancellation token to abort the initialization of the server.
/// The new dev server instance.
- public static async Task Start(CancellationToken ct)
+ public static async global::System.Threading.Tasks.Task Start(global::System.Threading.CancellationToken ct)
{
#if !HAS_UNO_DEVSERVER
throw new NotSupportedException("Dev server has not been referenced.");
@@ -54,9 +37,9 @@ public static async Task Start(CancellationToken ct)
#endif
}
- private readonly Process _process;
+ private readonly global::System.Diagnostics.Process _process;
- private DevServer(Process process, int port)
+ private DevServer(global::System.Diagnostics.Process process, int port)
{
Port = port;
_process = process;
@@ -67,16 +50,16 @@ private DevServer(Process process, int port)
///
public int Port { get; }
- private static async Task GetDevServer(CancellationToken ct)
+ private static async global::System.Threading.Tasks.Task GetDevServer(global::System.Threading.CancellationToken ct)
=> _devServerPath ??= await PullDevServer(ct);
///
/// Pulls the latest version of dev server from NuGet and returns the path to the executable
///
- private static async Task PullDevServer(CancellationToken ct)
+ private static async global::System.Threading.Tasks.Task PullDevServer(global::System.Threading.CancellationToken ct)
{
- var dir = Path.Combine(Path.GetTempPath(), $"DevServer_{Guid.NewGuid():N}");
- Directory.CreateDirectory(dir);
+ var dir = global::System.IO.Path.Combine(global::System.IO.Path.GetTempPath(), $"DevServer_{(global::System.Guid.NewGuid()):N}");
+ global::System.IO.Directory.CreateDirectory(dir);
try
{
@@ -86,7 +69,7 @@ private static async Task PullDevServer(CancellationToken ct)
ct,
"dotnet",
new() { "--version" },
- Environment.CurrentDirectory, // Needed to get the version used by the current app (i.e. including global.json)
+ global::System.Environment.CurrentDirectory, // Needed to get the version used by the current app (i.e. including global.json)
log);
var dotnetVersion = GetDotnetVersion(rawVersion);
@@ -96,12 +79,12 @@ private static async Task PullDevServer(CancellationToken ct)
net{dotnetVersion.Major}.{dotnetVersion.Minor}
";
- await File.WriteAllTextAsync(Path.Combine(dir, "PullDevServer.csproj"), csProj, ct);
+ await global::System.IO.File.WriteAllTextAsync(global::System.IO.Path.Combine(dir, "PullDevServer.csproj"), csProj, ct);
}
using (var log = _log.Scope("PULL_DEV_SERVER"))
{
- var args = new List { "add", "package" };
+ var args = new global::System.Collections.Generic.List { "add", "package" };
#if HAS_UNO_WINUI || WINDOWS_WINUI
args.Add("Uno.WinUI.DevServer");
#else
@@ -109,17 +92,15 @@ private static async Task PullDevServer(CancellationToken ct)
#endif
// If the assembly is not a debug version it should have a valid version
// Note: This is the version of the RemoteControl assembly, not the RemoteControl.Host, but they should be in sync (both are part of the DevServer package)
- if (Type.GetType("Uno.UI.RemoteControl.RemoteControlClient, Uno.UI.RemoteControl", throwOnError: false)
- ?.Assembly
- .GetCustomAttribute()
- ?.InformationalVersion is { Length: > 0 } runtimeVersion
- && Regex.Match(runtimeVersion, @"^(?\d+\.\d+\.\d+(-\w+\.\d+))+") is {Success: true} match)
+ if (global::System.Type.GetType("Uno.UI.RemoteControl.RemoteControlClient, Uno.UI.RemoteControl", throwOnError: false)?.Assembly is { } devServerAssembly
+ && global::System.Reflection.CustomAttributeExtensions.GetCustomAttribute(devServerAssembly)?.InformationalVersion is { Length: > 0 } runtimeVersion
+ && global::System.Text.RegularExpressions.Regex.Match(runtimeVersion, @"^(?\d+\.\d+\.\d+(-\w+\.\d+))+") is { Success: true } match)
{
args.Add("--version");
args.Add(match.Groups["version"].Value);
}
// Otherwise we use the version used to compile the test engine
- else if (typeof(DevServer).Assembly.GetCustomAttribute()?.Version is { Length: > 0 } version)
+ else if (global::System.Reflection.CustomAttributeExtensions.GetCustomAttribute(typeof(DevServer).Assembly)?.Version is { Length: > 0 } version)
{
args.Add("--version");
args.Add(version);
@@ -144,14 +125,14 @@ private static async Task PullDevServer(CancellationToken ct)
return GetConfigurationValue(data, "RemoteControlHostPath") is { Length: > 0 } path
? path
- : throw new InvalidOperationException("Failed to get remote control host path");
+ : throw new global::System.InvalidOperationException("Failed to get remote control host path");
}
}
finally
{
try
{
- Directory.Delete(dir, recursive: true);
+ global::System.IO.Directory.Delete(dir, recursive: true);
}
catch { /* Nothing to do */ }
}
@@ -162,51 +143,52 @@ private static async Task PullDevServer(CancellationToken ct)
///
private static DevServer StartCore(string hostBinPath, int port)
{
- if (!File.Exists(hostBinPath))
+ if (!global::System.IO.File.Exists(hostBinPath))
{
- _log.LogError($"DevServer {hostBinPath} does not exist");
- throw new InvalidOperationException($"Unable to find {hostBinPath}");
+ global::Microsoft.Extensions.Logging.LoggerExtensions.LogError(_log, $"DevServer {hostBinPath} does not exist");
+ throw new global::System.InvalidOperationException($"Unable to find {hostBinPath}");
}
- var arguments = $"\"{hostBinPath}\" --httpPort {port} --ppid {Environment.ProcessId} --metadata-updates true";
- var pi = new ProcessStartInfo("dotnet", arguments)
+ var arguments = $"\"{hostBinPath}\" --httpPort {port} --ppid {(global::System.Environment.ProcessId)} --metadata-updates true";
+ var pi = new global::System.Diagnostics.ProcessStartInfo("dotnet", arguments)
{
UseShellExecute = false,
CreateNoWindow = true,
- WindowStyle = ProcessWindowStyle.Hidden,
- WorkingDirectory = Path.GetDirectoryName(hostBinPath),
+ WindowStyle = global::System.Diagnostics.ProcessWindowStyle.Hidden,
+ WorkingDirectory = global::System.IO.Path.GetDirectoryName(hostBinPath),
};
- var process = new System.Diagnostics.Process { StartInfo = pi };
+ var process = new global::System.Diagnostics.Process { StartInfo = pi };
- process.StartAndLog(_log.Scope($"DEV_SERVER_{Interlocked.Increment(ref _instance):D2}"));
+ process.StartAndLog(_log.Scope($"DEV_SERVER_{(global::System.Threading.Interlocked.Increment(ref _instance)):D2}"));
return new DevServer(process, port);
}
#region Misc helpers
private static string? GetConfigurationValue(string msbuildResult, string nodeName)
- => Regex.Match(msbuildResult, $"<{nodeName}>(?.*?){nodeName}>") is { Success: true } match
+ => global::System.Text.RegularExpressions.Regex.Match(msbuildResult, $"<{nodeName}>(?.*?){nodeName}>") is { Success: true } match
? match.Groups["value"].Value
: null;
- private static Version GetDotnetVersion(string dotnetRawVersion)
- => Version.TryParse(dotnetRawVersion?.Split('-').FirstOrDefault(), out var version)
- ? version
- : throw new InvalidOperationException("Failed to read dotnet version");
+ private static global::System.Version GetDotnetVersion(string dotnetRawVersion)
+ => dotnetRawVersion?.Split('-') is { } versionParts
+ && global::System.Version.TryParse(global::System.Linq.Enumerable.FirstOrDefault(versionParts), out var version)
+ ? version
+ : throw new global::System.InvalidOperationException("Failed to read dotnet version");
private static int GetTcpPort()
{
- var l = new TcpListener(IPAddress.Loopback, 0);
+ var l = new global::System.Net.Sockets.TcpListener(global::System.Net.IPAddress.Loopback, 0);
l.Start();
- var port = ((IPEndPoint)l.LocalEndpoint).Port;
+ var port = ((global::System.Net.IPEndPoint)l.LocalEndpoint).Port;
l.Stop();
return port;
}
#endregion
///
- public async ValueTask DisposeAsync()
+ public async global::System.Threading.Tasks.ValueTask DisposeAsync()
{
if (_process is null or { HasExited: true })
{
@@ -217,12 +199,12 @@ public async ValueTask DisposeAsync()
{
_process.Kill(true); // Best effort, the app should kill itself anyway
}
- catch (Exception e)
+ catch (global::System.Exception e)
{
- _log.LogError("Failed to kill dev server", e);
+ global::Microsoft.Extensions.Logging.LoggerExtensions.LogError(_log, "Failed to kill dev server", e);
}
- await _process.WaitForExitAsync(CancellationToken.None);
+ await _process.WaitForExitAsync(global::System.Threading.CancellationToken.None);
}
}
diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/SecondaryApp.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/SecondaryApp.cs
index a4cd4a5..1c3d225 100644
--- a/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/SecondaryApp.cs
+++ b/src/Uno.UI.RuntimeTests.Engine.Library/Engine/ExternalRunner/_Private/SecondaryApp.cs
@@ -9,16 +9,6 @@
#define IS_SECONDARY_APP_SUPPORTED
#endif
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Threading.Tasks;
-using System.Threading;
-using System.Linq;
-using System.Text.Json;
-using System.Text.Json.Serialization;
-using Uno.Extensions;
-
namespace Uno.UI.RuntimeTests.Internal.Helpers;
///
@@ -47,10 +37,10 @@ internal static partial class SecondaryApp
/// Token to cancel the test run.
/// Indicates if the application should be ran head-less or not.
/// The test results.
- internal static async Task RunTest(UnitTestEngineConfig config, CancellationToken ct, bool isAppVisible = false)
+ internal static async global::System.Threading.Tasks.Task RunTest(UnitTestEngineConfig config, global::System.Threading.CancellationToken ct, bool isAppVisible = false)
{
#if !IS_SECONDARY_APP_SUPPORTED
- throw new NotSupportedException("Secondary app is not supported on this platform.");
+ throw new global::System.NotSupportedException("Secondary app is not supported on this platform.");
#else
// First we fetch and start the dev-server (needed to HR tests for instance)
await using var devServer = await DevServer.Start(ct);
@@ -61,13 +51,13 @@ internal static async Task RunTest(UnitTestEngineConfig config
// Finally, read the test results
try
{
- var results = await JsonSerializer.DeserializeAsync(File.OpenRead(resultFile), cancellationToken: ct);
+ var results = await global::System.Text.Json.JsonSerializer.DeserializeAsync(global::System.IO.File.OpenRead(resultFile), cancellationToken: ct);
- return results ?? Array.Empty();
+ return results ?? global::System.Array.Empty();
}
- catch (JsonException error)
+ catch (global::System.Text.Json.JsonException error)
{
- throw new InvalidOperationException(
+ throw new global::System.InvalidOperationException(
$"Failed to deserialize the test results from '{resultFile}', this usually indicates that the secondary app has been closed (or crashed) before the end of the test suit.",
error);
}
@@ -75,18 +65,19 @@ internal static async Task RunTest(UnitTestEngineConfig config
private static int _instance;
- private static async Task RunLocalApp(string devServerHost, int devServerPort, UnitTestEngineConfig config, bool isAppVisible, CancellationToken ct)
+ private static async global::System.Threading.Tasks.Task RunLocalApp(string devServerHost, int devServerPort, UnitTestEngineConfig config, bool isAppVisible, global::System.Threading.CancellationToken ct)
{
- var testOutput = Path.GetTempFileName();
+ var testOutput = global::System.IO.Path.GetTempFileName();
+ var configJson = global::System.Text.Json.JsonSerializer.Serialize(config, new global::System.Text.Json.JsonSerializerOptions { DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingDefault });
- var childStartInfo = new ProcessStartInfo(
- Environment.ProcessPath ?? throw new InvalidOperationException("Cannot determine the current app executable path"),
- string.Join(" ", Environment.GetCommandLineArgs().Select(arg => '"' + arg + '"')))
+ var childStartInfo = new global::System.Diagnostics.ProcessStartInfo(
+ global::System.Environment.ProcessPath ?? throw new global::System.InvalidOperationException("Cannot determine the current app executable path"),
+ string.Join(" ", global::System.Linq.Enumerable.Select(global::System.Environment.GetCommandLineArgs(), arg => '"' + arg + '"')))
{
UseShellExecute = false,
CreateNoWindow = !isAppVisible,
- WindowStyle = isAppVisible ? ProcessWindowStyle.Normal : ProcessWindowStyle.Hidden,
- WorkingDirectory = Environment.CurrentDirectory,
+ WindowStyle = isAppVisible ? global::System.Diagnostics.ProcessWindowStyle.Normal : global::System.Diagnostics.ProcessWindowStyle.Hidden,
+ WorkingDirectory = global::System.Environment.CurrentDirectory,
};
// Configure the runtime to allow hot-reload
@@ -97,14 +88,14 @@ private static async Task RunLocalApp(string devServerHost, int devServe
childStartInfo.EnvironmentVariables.Add("UNO_DEV_SERVER_PORT", devServerPort.ToString());
// Request to the runtime tests engine to auto-start at startup
- childStartInfo.EnvironmentVariables.Add("UNO_RUNTIME_TESTS_RUN_TESTS", JsonSerializer.Serialize(config, new JsonSerializerOptions { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault }));
+ childStartInfo.EnvironmentVariables.Add("UNO_RUNTIME_TESTS_RUN_TESTS", configJson);
childStartInfo.EnvironmentVariables.Add("UNO_RUNTIME_TESTS_OUTPUT_PATH", testOutput);
childStartInfo.EnvironmentVariables.Add("UNO_RUNTIME_TESTS_OUTPUT_KIND", "UnoRuntimeTests"); // "NUnit"
childStartInfo.EnvironmentVariables.Add("UNO_RUNTIME_TESTS_IS_SECONDARY_APP", "true"); // "NUnit"
- var childProcess = new Process { StartInfo = childStartInfo };
+ var childProcess = new global::System.Diagnostics.Process { StartInfo = childStartInfo };
- await childProcess.ExecuteAndLogAsync(typeof(SecondaryApp).CreateScopedLog($"CHILD_TEST_APP_{Interlocked.Increment(ref _instance):D2}"), ct);
+ await childProcess.ExecuteAndLogAsync(typeof(SecondaryApp).CreateScopedLog($"CHILD_TEST_APP_{(global::System.Threading.Interlocked.Increment(ref _instance)):D2}"), ct);
return testOutput;
#endif
diff --git a/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/AsyncAssert.cs b/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/AsyncAssert.cs
index 593de94..16dfafc 100644
--- a/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/AsyncAssert.cs
+++ b/src/Uno.UI.RuntimeTests.Engine.Library/Library/Helpers/AsyncAssert.cs
@@ -3,15 +3,6 @@
#pragma warning disable
#endif
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Runtime.CompilerServices;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
namespace Uno.UI.RuntimeTests;
public static partial class AsyncAssert
@@ -25,13 +16,13 @@ public static partial class AsyncAssert
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsTrue(
- Func condition,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("condition")] string conditionExpression = "")
- => IsTrueCore(condition, $"{conditionExpression} to be true but found false ({Path.GetFileName(file)}@{line})", TestHelper.DefaultTimeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsTrue(
+ global::System.Func condition,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("condition")] string conditionExpression = "")
+ => IsTrueCore(condition, $"{conditionExpression} to be true but found false ({(global::System.IO.Path.GetFileName(file))}@{line})", TestHelper.DefaultTimeout, ct);
///
/// Asynchronously tests whether the specified condition is true and throws an exception if the condition is false.
@@ -42,14 +33,14 @@ public static ValueTask IsTrue(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsTrue(
- Func condition,
- TimeSpan timeout,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("condition")] string conditionExpression = "")
- => IsTrueCore(condition, $"{conditionExpression} to be true but found false ({Path.GetFileName(file)}@{line})", timeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsTrue(
+ global::System.Func condition,
+ global::System.TimeSpan timeout,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("condition")] string conditionExpression = "")
+ => IsTrueCore(condition, $"{conditionExpression} to be true but found false ({(global::System.IO.Path.GetFileName(file))}@{line})", timeout, ct);
///
/// Asynchronously tests whether the specified condition is true and throws an exception if the condition is false.
@@ -60,14 +51,14 @@ public static ValueTask IsTrue(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsTrue(
- Func condition,
+ public static global::System.Threading.Tasks.ValueTask IsTrue(
+ global::System.Func condition,
int timeoutMs,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("condition")] string conditionExpression = "")
- => IsTrueCore(condition, $"{conditionExpression} to be true but found false ({Path.GetFileName(file)}@{line})", TimeSpan.FromMilliseconds(timeoutMs), ct);
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("condition")] string conditionExpression = "")
+ => IsTrueCore(condition, $"{conditionExpression} to be true but found false ({(global::System.IO.Path.GetFileName(file))}@{line})", global::System.TimeSpan.FromMilliseconds(timeoutMs), ct);
///
/// Asynchronously tests whether the specified condition is true and throws an exception if the condition is false.
@@ -75,7 +66,7 @@ public static ValueTask IsTrue(
/// The condition the test expects to be true.
/// The message to include in the exception when condition is not equal to expected. The message is shown in test results.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsTrue(Func condition, string message, CancellationToken ct = default)
+ public static global::System.Threading.Tasks.ValueTask IsTrue(global::System.Func condition, string message, global::System.Threading.CancellationToken ct = default)
=> IsTrueCore(condition, message, TestHelper.DefaultTimeout, ct);
///
@@ -85,7 +76,7 @@ public static ValueTask IsTrue(Func condition, string message, Cancellatio
/// The message to include in the exception when condition is not equal to expected. The message is shown in test results.
/// The max duration to wait for.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsTrue(Func condition, string message, TimeSpan timeout, CancellationToken ct = default)
+ public static global::System.Threading.Tasks.ValueTask IsTrue(global::System.Func condition, string message, global::System.TimeSpan timeout, global::System.Threading.CancellationToken ct = default)
=> IsTrueCore(condition, message, timeout, ct);
///
@@ -95,8 +86,8 @@ public static ValueTask IsTrue(Func condition, string message, TimeSpan ti
/// The message to include in the exception when condition is not equal to expected. The message is shown in test results.
/// The max duration to wait for in milliseconds.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsTrue(Func condition, string message, int timeoutMs, CancellationToken ct = default)
- => IsTrueCore( condition, message, TimeSpan.FromMilliseconds(timeoutMs), ct);
+ public static global::System.Threading.Tasks.ValueTask IsTrue(global::System.Func condition, string message, int timeoutMs, global::System.Threading.CancellationToken ct = default)
+ => IsTrueCore( condition, message, global::System.TimeSpan.FromMilliseconds(timeoutMs), ct);
///
/// Asynchronously tests whether the specified condition is true and throws an exception if the condition is false.
@@ -106,13 +97,13 @@ public static ValueTask IsTrue(Func condition, string message, int timeout
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsTrue(
- Func> condition,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("condition")] string conditionExpression = "")
- => IsTrueCore(condition, $"{conditionExpression} to be true but found false ({Path.GetFileName(file)}@{line})", TestHelper.DefaultTimeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsTrue(
+ global::System.Func> condition,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("condition")] string conditionExpression = "")
+ => IsTrueCore(condition, $"{conditionExpression} to be true but found false ({(global::System.IO.Path.GetFileName(file))}@{line})", TestHelper.DefaultTimeout, ct);
///
/// Asynchronously tests whether the specified condition is true and throws an exception if the condition is false.
@@ -123,14 +114,14 @@ public static ValueTask IsTrue(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsTrue(
- Func> condition,
- TimeSpan timeout,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("condition")] string conditionExpression = "")
- => IsTrueCore(condition, $"{conditionExpression} to be true but found false ({Path.GetFileName(file)}@{line})", timeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsTrue(
+ global::System.Func> condition,
+ global::System.TimeSpan timeout,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("condition")] string conditionExpression = "")
+ => IsTrueCore(condition, $"{conditionExpression} to be true but found false ({(global::System.IO.Path.GetFileName(file))}@{line})", timeout, ct);
///
/// Asynchronously tests whether the specified condition is true and throws an exception if the condition is false.
@@ -141,14 +132,14 @@ public static ValueTask IsTrue(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsTrue(
- Func> condition,
+ public static global::System.Threading.Tasks.ValueTask IsTrue(
+ global::System.Func> condition,
int timeoutMs,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("condition")] string conditionExpression = "")
- => IsTrueCore(condition, $"{conditionExpression} to be true but found false ({Path.GetFileName(file)}@{line})", TimeSpan.FromMilliseconds(timeoutMs), ct);
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("condition")] string conditionExpression = "")
+ => IsTrueCore(condition, $"{conditionExpression} to be true but found false ({(global::System.IO.Path.GetFileName(file))}@{line})", global::System.TimeSpan.FromMilliseconds(timeoutMs), ct);
///
/// Asynchronously tests whether the specified condition is true and throws an exception if the condition is false.
@@ -156,7 +147,7 @@ public static ValueTask IsTrue(
/// The condition the test expects to be true.
/// The message to include in the exception when condition is not equal to expected. The message is shown in test results.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsTrue(Func> condition, string message, CancellationToken ct = default)
+ public static global::System.Threading.Tasks.ValueTask IsTrue(global::System.Func> condition, string message, global::System.Threading.CancellationToken ct = default)
=> IsTrueCore(condition, message, TestHelper.DefaultTimeout, ct);
///
@@ -166,7 +157,7 @@ public static ValueTask IsTrue(Func> condition, string message,
/// The message to include in the exception when condition is not equal to expected. The message is shown in test results.
/// The max duration to wait for.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsTrue(Func> condition, string message, TimeSpan timeout, CancellationToken ct = default)
+ public static global::System.Threading.Tasks.ValueTask IsTrue(global::System.Func> condition, string message, global::System.TimeSpan timeout, global::System.Threading.CancellationToken ct = default)
=> IsTrueCore(condition, message, timeout, ct);
///
@@ -176,21 +167,21 @@ public static ValueTask IsTrue(Func> condition, string message,
/// The message to include in the exception when condition is not equal to expected. The message is shown in test results.
/// The max duration to wait for in milliseconds.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsTrue(Func> condition, string message, int timeoutMs, CancellationToken ct = default)
- => IsTrueCore(condition, message, TimeSpan.FromMilliseconds(timeoutMs), ct);
+ public static global::System.Threading.Tasks.ValueTask IsTrue(global::System.Func> condition, string message, int timeoutMs, global::System.Threading.CancellationToken ct = default)
+ => IsTrueCore(condition, message, global::System.TimeSpan.FromMilliseconds(timeoutMs), ct);
- private static async ValueTask IsTrueCore(Func condition, string reason, TimeSpan timeout, CancellationToken ct)
+ private static async global::System.Threading.Tasks.ValueTask IsTrueCore(global::System.Func condition, string reason, global::System.TimeSpan timeout, global::System.Threading.CancellationToken ct)
{
await TestHelper.TryWaitFor(condition, timeout, ct);
- Assert.IsTrue(condition(), reason);
+ global::Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsTrue(condition(), reason);
}
- private static async ValueTask IsTrueCore(Func> condition, string reason, TimeSpan timeout, CancellationToken ct)
+ private static async global::System.Threading.Tasks.ValueTask IsTrueCore(global::System.Func> condition, string reason, global::System.TimeSpan timeout, global::System.Threading.CancellationToken ct)
{
await TestHelper.TryWaitFor(async _ => await condition().ConfigureAwait(false), timeout, ct);
- Assert.IsTrue(await condition().ConfigureAwait(false), reason);
+ global::Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsTrue(await condition().ConfigureAwait(false), reason);
}
#endregion
@@ -203,13 +194,13 @@ private static async ValueTask IsTrueCore(Func> condition, strin
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsFalse(
- Func condition,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("condition")] string conditionExpression = "")
- => IsFalseCore(condition, $"{conditionExpression} to be false but found true ({Path.GetFileName(file)}@{line})", TestHelper.DefaultTimeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsFalse(
+ global::System.Func condition,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("condition")] string conditionExpression = "")
+ => IsFalseCore(condition, $"{conditionExpression} to be false but found true ({(global::System.IO.Path.GetFileName(file))}@{line})", TestHelper.DefaultTimeout, ct);
///
/// Asynchronously tests whether the specified condition is false and throws an exception if the condition is true.
@@ -220,14 +211,14 @@ public static ValueTask IsFalse(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsFalse(
- Func condition,
- TimeSpan timeout,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("condition")] string conditionExpression = "")
- => IsFalseCore(condition, $"{conditionExpression} to be false but found true ({Path.GetFileName(file)}@{line})", timeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsFalse(
+ global::System.Func condition,
+ global::System.TimeSpan timeout,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("condition")] string conditionExpression = "")
+ => IsFalseCore(condition, $"{conditionExpression} to be false but found true ({(global::System.IO.Path.GetFileName(file))}@{line})", timeout, ct);
///
/// Asynchronously tests whether the specified condition is false and throws an exception if the condition is true.
@@ -238,14 +229,14 @@ public static ValueTask IsFalse(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsFalse(
- Func condition,
+ public static global::System.Threading.Tasks.ValueTask IsFalse(
+ global::System.Func condition,
int timeoutMs,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("condition")] string conditionExpression = "")
- => IsFalseCore(condition, $"{conditionExpression} to be false but found true ({Path.GetFileName(file)}@{line})", TimeSpan.FromMilliseconds(timeoutMs), ct);
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("condition")] string conditionExpression = "")
+ => IsFalseCore(condition, $"{conditionExpression} to be false but found true ({(global::System.IO.Path.GetFileName(file))}@{line})", global::System.TimeSpan.FromMilliseconds(timeoutMs), ct);
///
/// Asynchronously tests whether the specified condition is false and throws an exception if the condition is true.
@@ -253,7 +244,7 @@ public static ValueTask IsFalse(
/// The condition the test expects to be false.
/// The message to include in the exception when condition is not equal to expected. The message is shown in test results.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsFalse(Func condition, string message, CancellationToken ct = default)
+ public static global::System.Threading.Tasks.ValueTask IsFalse(global::System.Func condition, string message, global::System.Threading.CancellationToken ct = default)
=> IsFalseCore(condition, message, TestHelper.DefaultTimeout, ct);
///
@@ -263,7 +254,7 @@ public static ValueTask IsFalse(Func condition, string message, Cancellati
/// The message to include in the exception when condition is not equal to expected. The message is shown in test results.
/// The max duration to wait for.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsFalse(Func condition, string message, TimeSpan timeout, CancellationToken ct = default)
+ public static global::System.Threading.Tasks.ValueTask IsFalse(global::System.Func condition, string message, global::System.TimeSpan timeout, global::System.Threading.CancellationToken ct = default)
=> IsFalseCore(condition, message, timeout, ct);
///
@@ -273,8 +264,8 @@ public static ValueTask IsFalse(Func condition, string message, TimeSpan t
/// The message to include in the exception when condition is not equal to expected. The message is shown in test results.
/// The max duration to wait for in milliseconds.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsFalse(Func condition, string message, int timeoutMs, CancellationToken ct = default)
- => IsFalseCore(condition, message, TimeSpan.FromMilliseconds(timeoutMs), ct);
+ public static global::System.Threading.Tasks.ValueTask IsFalse(global::System.Func condition, string message, int timeoutMs, global::System.Threading.CancellationToken ct = default)
+ => IsFalseCore(condition, message, global::System.TimeSpan.FromMilliseconds(timeoutMs), ct);
///
/// Asynchronously tests whether the specified condition is false and throws an exception if the condition is true.
@@ -284,13 +275,13 @@ public static ValueTask IsFalse(Func condition, string message, int timeou
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsFalse(
- Func> condition,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("condition")] string conditionExpression = "")
- => IsFalseCore(condition, $"{conditionExpression} to be false but found true ({Path.GetFileName(file)}@{line})", TestHelper.DefaultTimeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsFalse(
+ global::System.Func> condition,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("condition")] string conditionExpression = "")
+ => IsFalseCore(condition, $"{conditionExpression} to be false but found true ({(global::System.IO.Path.GetFileName(file))}@{line})", TestHelper.DefaultTimeout, ct);
///
/// Asynchronously tests whether the specified condition is false and throws an exception if the condition is true.
@@ -301,14 +292,14 @@ public static ValueTask IsFalse(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsFalse(
- Func> condition,
- TimeSpan timeout,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("condition")] string conditionExpression = "")
- => IsFalseCore(condition, $"{conditionExpression} to be false but found true ({Path.GetFileName(file)}@{line})", timeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsFalse(
+ global::System.Func> condition,
+ global::System.TimeSpan timeout,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("condition")] string conditionExpression = "")
+ => IsFalseCore(condition, $"{conditionExpression} to be false but found true ({(global::System.IO.Path.GetFileName(file))}@{line})", timeout, ct);
///
/// Asynchronously tests whether the specified condition is false and throws an exception if the condition is true.
@@ -319,14 +310,14 @@ public static ValueTask IsFalse(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsFalse(
- Func> condition,
+ public static global::System.Threading.Tasks.ValueTask IsFalse(
+ global::System.Func> condition,
int timeoutMs,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("condition")] string conditionExpression = "")
- => IsFalseCore(condition, $"{conditionExpression} to be false but found true ({Path.GetFileName(file)}@{line})", TimeSpan.FromMilliseconds(timeoutMs), ct);
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("condition")] string conditionExpression = "")
+ => IsFalseCore(condition, $"{conditionExpression} to be false but found true ({(global::System.IO.Path.GetFileName(file))}@{line})", global::System.TimeSpan.FromMilliseconds(timeoutMs), ct);
///
/// Asynchronously tests whether the specified condition is false and throws an exception if the condition is true.
@@ -334,7 +325,7 @@ public static ValueTask IsFalse(
/// The condition the test expects to be false.
/// The message to include in the exception when condition is not equal to expected. The message is shown in test results.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsFalse(Func> condition, string message, CancellationToken ct = default)
+ public static global::System.Threading.Tasks.ValueTask IsFalse(global::System.Func> condition, string message, global::System.Threading.CancellationToken ct = default)
=> IsFalseCore(condition, message, TestHelper.DefaultTimeout, ct);
///
@@ -344,7 +335,7 @@ public static ValueTask IsFalse(Func> condition, string message,
/// The message to include in the exception when condition is not equal to expected. The message is shown in test results.
/// The max duration to wait for.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsFalse(Func> condition, string message, TimeSpan timeout, CancellationToken ct = default)
+ public static global::System.Threading.Tasks.ValueTask IsFalse(global::System.Func> condition, string message, global::System.TimeSpan timeout, global::System.Threading.CancellationToken ct = default)
=> IsFalseCore(condition, message, timeout, ct);
///
@@ -354,21 +345,21 @@ public static ValueTask IsFalse(Func> condition, string message,
/// The message to include in the exception when condition is not equal to expected. The message is shown in test results.
/// The max duration to wait for in milliseconds.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsFalse(Func> condition, string message, int timeoutMs, CancellationToken ct = default)
- => IsFalseCore(condition, message, TimeSpan.FromMilliseconds(timeoutMs), ct);
+ public static global::System.Threading.Tasks.ValueTask IsFalse(global::System.Func> condition, string message, int timeoutMs, global::System.Threading.CancellationToken ct = default)
+ => IsFalseCore(condition, message, global::System.TimeSpan.FromMilliseconds(timeoutMs), ct);
- private static async ValueTask IsFalseCore(Func condition, string reason, TimeSpan timeout, CancellationToken ct)
+ private static async global::System.Threading.Tasks.ValueTask IsFalseCore(global::System.Func condition, string reason, global::System.TimeSpan timeout, global::System.Threading.CancellationToken ct)
{
await TestHelper.TryWaitFor(() => !condition(), timeout, ct);
- Assert.IsFalse(condition(), reason);
+ global::Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsFalse(condition(), reason);
}
- private static async ValueTask IsFalseCore(Func> condition, string reason, TimeSpan timeout, CancellationToken ct)
+ private static async global::System.Threading.Tasks.ValueTask IsFalseCore(global::System.Func> condition, string reason, global::System.TimeSpan timeout, global::System.Threading.CancellationToken ct)
{
await TestHelper.TryWaitFor(async _ => !await condition().ConfigureAwait(false), timeout, ct);
- Assert.IsFalse(await condition().ConfigureAwait(false), reason);
+ global::Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsFalse(await condition().ConfigureAwait(false), reason);
}
#endregion
@@ -382,13 +373,13 @@ private static async ValueTask IsFalseCore(Func> condition, stri
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsNull(
- Func value,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("value")] string valueExpression = "")
- => IsNullCore(value, a => $"{valueExpression} to be null but found {a} ({Path.GetFileName(file)}@{line})", TestHelper.DefaultTimeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsNull(
+ global::System.Func value,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("value")] string valueExpression = "")
+ => IsNullCore(value, a => $"{valueExpression} to be null but found {a} ({(global::System.IO.Path.GetFileName(file))}@{line})", TestHelper.DefaultTimeout, ct);
///
/// Asynchronously tests whether the specified object is null and throws an exception if it is not.
@@ -400,14 +391,14 @@ public static ValueTask IsNull(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsNull(
- Func value,
- TimeSpan timeout,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("value")] string valueExpression = "")
- => IsNullCore(value, a => $"{valueExpression} to be null but found {a} ({Path.GetFileName(file)}@{line})", timeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsNull(
+ global::System.Func value,
+ global::System.TimeSpan timeout,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("value")] string valueExpression = "")
+ => IsNullCore(value, a => $"{valueExpression} to be null but found {a} ({(global::System.IO.Path.GetFileName(file))}@{line})", timeout, ct);
///
/// Asynchronously tests whether the specified object is null and throws an exception if it is not.
@@ -419,14 +410,14 @@ public static ValueTask IsNull(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsNull(
- Func value,
+ public static global::System.Threading.Tasks.ValueTask IsNull(
+ global::System.Func value,
int timeoutMs,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("value")] string valueExpression = "")
- => IsNullCore(value, a => $"{valueExpression} to be null but found {a} ({Path.GetFileName(file)}@{line})", TimeSpan.FromMilliseconds(timeoutMs), ct);
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("value")] string valueExpression = "")
+ => IsNullCore(value, a => $"{valueExpression} to be null but found {a} ({(global::System.IO.Path.GetFileName(file))}@{line})", global::System.TimeSpan.FromMilliseconds(timeoutMs), ct);
///
/// Asynchronously tests whether the specified object is null and throws an exception if it is not.
@@ -435,7 +426,7 @@ public static ValueTask IsNull(
/// The object the test expects to be null.
/// The message to include in the exception when value is not equal to expected. The message is shown in test results.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsNull(Func value, string message, CancellationToken ct = default)
+ public static global::System.Threading.Tasks.ValueTask IsNull(global::System.Func value, string message, global::System.Threading.CancellationToken ct = default)
=> IsNullCore(value, a => message, TestHelper.DefaultTimeout, ct);
///
@@ -446,7 +437,7 @@ public static ValueTask IsNull(Func value, string message, CancellationTok
/// The message to include in the exception when value is not equal to expected. The message is shown in test results.
/// The max duration to wait for.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsNull(Func value, string message, TimeSpan timeout, CancellationToken ct = default)
+ public static global::System.Threading.Tasks.ValueTask IsNull(global::System.Func value, string message, global::System.TimeSpan timeout, global::System.Threading.CancellationToken ct = default)
=> IsNullCore(value, a => message, timeout, ct);
///
@@ -457,8 +448,8 @@ public static ValueTask IsNull(Func value, string message, TimeSpan timeou
/// The message to include in the exception when value is not equal to expected. The message is shown in test results.
/// The max duration to wait for in milliseconds.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsNull(Func value, string message, int timeoutMs, CancellationToken ct = default)
- => IsNullCore(value, a => message, TimeSpan.FromMilliseconds(timeoutMs), ct);
+ public static global::System.Threading.Tasks.ValueTask IsNull(global::System.Func value, string message, int timeoutMs, global::System.Threading.CancellationToken ct = default)
+ => IsNullCore(value, a => message, global::System.TimeSpan.FromMilliseconds(timeoutMs), ct);
///
/// Asynchronously tests whether the specified object is null and throws an exception if it is not.
@@ -469,13 +460,13 @@ public static ValueTask IsNull(Func value, string message, int timeoutMs,
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsNull(
- Func> value,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("value")] string valueExpression = "")
- => IsNullCore(value, a => $"{valueExpression} to be null but found {a} ({Path.GetFileName(file)}@{line})", TestHelper.DefaultTimeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsNull(
+ global::System.Func> value,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("value")] string valueExpression = "")
+ => IsNullCore(value, a => $"{valueExpression} to be null but found {a} ({(global::System.IO.Path.GetFileName(file))}@{line})", TestHelper.DefaultTimeout, ct);
///
/// Asynchronously tests whether the specified object is null and throws an exception if it is not.
@@ -487,14 +478,14 @@ public static ValueTask IsNull(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsNull(
- Func> value,
- TimeSpan timeout,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("value")] string valueExpression = "")
- => IsNullCore(value, a => $"{valueExpression} to be null but found {a} ({Path.GetFileName(file)}@{line})", timeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsNull(
+ global::System.Func> value,
+ global::System.TimeSpan timeout,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("value")] string valueExpression = "")
+ => IsNullCore(value, a => $"{valueExpression} to be null but found {a} ({(global::System.IO.Path.GetFileName(file))}@{line})", timeout, ct);
///
/// Asynchronously tests whether the specified object is null and throws an exception if it is not.
@@ -506,14 +497,14 @@ public static ValueTask IsNull(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsNull(
- Func> value,
+ public static global::System.Threading.Tasks.ValueTask IsNull(
+ global::System.Func> value,
int timeoutMs,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("value")] string valueExpression = "")
- => IsNullCore(value, a => $"{valueExpression} to be null but found {a} ({Path.GetFileName(file)}@{line})", TimeSpan.FromMilliseconds(timeoutMs), ct);
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("value")] string valueExpression = "")
+ => IsNullCore(value, a => $"{valueExpression} to be null but found {a} ({(global::System.IO.Path.GetFileName(file))}@{line})", global::System.TimeSpan.FromMilliseconds(timeoutMs), ct);
///
/// Asynchronously tests whether the specified object is null and throws an exception if it is not.
@@ -522,7 +513,7 @@ public static ValueTask IsNull(
/// The object the test expects to be null.
/// The message to include in the exception when value is not equal to expected. The message is shown in test results.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsNull(Func> value, string message, CancellationToken ct = default)
+ public static global::System.Threading.Tasks.ValueTask IsNull(global::System.Func> value, string message, global::System.Threading.CancellationToken ct = default)
=> IsNullCore(value, a => message, TestHelper.DefaultTimeout, ct);
///
@@ -533,7 +524,7 @@ public static ValueTask IsNull(Func> value, string message, Canc
/// The message to include in the exception when value is not equal to expected. The message is shown in test results.
/// The max duration to wait for.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsNull(Func> value, string message, TimeSpan timeout, CancellationToken ct = default)
+ public static global::System.Threading.Tasks.ValueTask IsNull(global::System.Func> value, string message, global::System.TimeSpan timeout, global::System.Threading.CancellationToken ct = default)
=> IsNullCore(value, a => message, timeout, ct);
///
@@ -544,23 +535,23 @@ public static ValueTask IsNull(Func> value, string message, Time
/// The message to include in the exception when value is not equal to expected. The message is shown in test results.
/// The max duration to wait for in milliseconds.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsNull(Func> value, string message, int timeoutMs, CancellationToken ct = default)
- => IsNullCore(value, a => message, TimeSpan.FromMilliseconds(timeoutMs), ct);
+ public static global::System.Threading.Tasks.ValueTask IsNull(global::System.Func> value, string message, int timeoutMs, global::System.Threading.CancellationToken ct = default)
+ => IsNullCore(value, a => message, global::System.TimeSpan.FromMilliseconds(timeoutMs), ct);
- private static async ValueTask IsNullCore(Func value, Func reason, TimeSpan timeout, CancellationToken ct)
+ private static async global::System.Threading.Tasks.ValueTask IsNullCore(global::System.Func value, global::System.Func reason, global::System.TimeSpan timeout, global::System.Threading.CancellationToken ct)
{
await TestHelper.TryWaitFor(() => object.Equals(null, value()), timeout, ct);
var a = value();
- Assert.IsNull(a, reason(a));
+ global::Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNull(a, reason(a));
}
- private static async ValueTask IsNullCore(Func> value, Func reason, TimeSpan timeout, CancellationToken ct)
+ private static async global::System.Threading.Tasks.ValueTask IsNullCore(global::System.Func> value, global::System.Func reason, global::System.TimeSpan timeout, global::System.Threading.CancellationToken ct)
{
await TestHelper.TryWaitFor(async _ => object.Equals(null, await value().ConfigureAwait(false)), timeout, ct);
var a = await value().ConfigureAwait(false);
- Assert.IsNotNull(a, reason(a));
+ global::Microsoft.VisualStudio.TestTools.UnitTesting.Assert.IsNotNull(a, reason(a));
}
#endregion
@@ -574,13 +565,13 @@ private static async ValueTask IsNullCore(Func> value, FuncFor debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsNotNull(
- Func value,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("value")] string valueExpression = "")
- => IsNotNullCore(value, a => $"{valueExpression} to be null but found {a} ({Path.GetFileName(file)}@{line})", TestHelper.DefaultTimeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsNotNull(
+ global::System.Func value,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("value")] string valueExpression = "")
+ => IsNotNullCore(value, a => $"{valueExpression} to be null but found {a} ({(global::System.IO.Path.GetFileName(file))}@{line})", TestHelper.DefaultTimeout, ct);
///
/// Asynchronously tests whether the specified object is non-null and throws an exception if it is null.
@@ -592,14 +583,14 @@ public static ValueTask IsNotNull(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsNotNull(
- Func value,
- TimeSpan timeout,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("value")] string valueExpression = "")
- => IsNotNullCore(value, a => $"{valueExpression} to be null but found {a} ({Path.GetFileName(file)}@{line})", timeout, ct);
+ public static global::System.Threading.Tasks.ValueTask IsNotNull(
+ global::System.Func value,
+ global::System.TimeSpan timeout,
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("value")] string valueExpression = "")
+ => IsNotNullCore(value, a => $"{valueExpression} to be null but found {a} ({(global::System.IO.Path.GetFileName(file))}@{line})", timeout, ct);
///
/// Asynchronously tests whether the specified object is non-null and throws an exception if it is null.
@@ -611,14 +602,14 @@ public static ValueTask IsNotNull(
/// For debug purposes.
/// For debug purposes.
/// For debug purposes.
- public static ValueTask IsNotNull(
- Func value,
+ public static global::System.Threading.Tasks.ValueTask IsNotNull(
+ global::System.Func value,
int timeoutMs,
- CancellationToken ct = default,
- [CallerLineNumber] int line = -1,
- [CallerFilePath] string file = "",
- [CallerArgumentExpression("value")] string valueExpression = "")
- => IsNotNullCore(value, a => $"{valueExpression} to be null but found {a} ({Path.GetFileName(file)}@{line})", TimeSpan.FromMilliseconds(timeoutMs), ct);
+ global::System.Threading.CancellationToken ct = default,
+ [global::System.Runtime.CompilerServices.CallerLineNumber] int line = -1,
+ [global::System.Runtime.CompilerServices.CallerFilePath] string file = "",
+ [global::System.Runtime.CompilerServices.CallerArgumentExpression("value")] string valueExpression = "")
+ => IsNotNullCore(value, a => $"{valueExpression} to be null but found {a} ({(global::System.IO.Path.GetFileName(file))}@{line})", global::System.TimeSpan.FromMilliseconds(timeoutMs), ct);
///
/// Asynchronously tests whether the specified object is non-null and throws an exception if it is null.
@@ -627,7 +618,7 @@ public static ValueTask IsNotNull(
/// The object the test expects to be null.
/// The message to include in the exception when value is not equal to expected. The message is shown in test results.
/// Cancellation token to cancel teh asynchronous operation
- public static ValueTask IsNotNull(Func value, string message, CancellationToken ct = default)
+ public static global::System.Threading.Tasks.ValueTask IsNotNull(global::System.Func