Rhinobyte.Extensions.TestTools
8.0.0-preview.1
dotnet add package Rhinobyte.Extensions.TestTools --version 8.0.0-preview.1
NuGet\Install-Package Rhinobyte.Extensions.TestTools -Version 8.0.0-preview.1
<PackageReference Include="Rhinobyte.Extensions.TestTools" Version="8.0.0-preview.1" />
paket add Rhinobyte.Extensions.TestTools --version 8.0.0-preview.1
#r "nuget: Rhinobyte.Extensions.TestTools, 8.0.0-preview.1"
// Install Rhinobyte.Extensions.TestTools as a Cake Addin #addin nuget:?package=Rhinobyte.Extensions.TestTools&version=8.0.0-preview.1&prerelease // Install Rhinobyte.Extensions.TestTools as a Cake Tool #tool nuget:?package=Rhinobyte.Extensions.TestTools&version=8.0.0-preview.1&prerelease
Rhinobyte.Extensions.TestTools
This library contains general purpose testing helper/extension types and extensions for MSTest
ApartmentState Test Attributes
Windows platform specific [ApartmentStateTestClass(..)]
and [ApartmentStateTestMethod(..)]
attributes that will ensure the test execution happens using the
specified thread apartment state
Example Usage:
[ApartmentStateTestClass(ApartmentState.STA)]
public class YourTestClass
{
[TestMethod]
public async Task YourTestMethod1() { /** ... **/ }
[TestMethod]
public async Task YourTestMethod2() { /** ... **/ }
}
[TestClass]
public class YourOtherTestClass
{
[ApartmentStateTestMethod(ApartmentState.STA)]
public async Task YourTestMethod3() { /** ... **/ }
}
StringComparisonHelper and StringAssertionExtensions
String comparison helper logic and test assertion methods for performing line by line comparison of two strings and returning a description of the per line differences.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Rhinobyte.Extensions.TestTools.Assertions;
using System;
using System.Threading;
using System.Threading.Tasks;
[TestClass]
public class YourTestClass
{
[TestMethod]
public async Task YourTestMethod()
{
var actualResult = ... something ...
var expectedResult = await File.ReadAllTextAsync(someFilePath, CancellationTokenForTest);
actualResult.ShouldBeSameAs(expectedResult);
}
}
WaitUtility
A test helper wait utility to perform asynchronous delays and wait loops that poll for a conditionl match. Includes support for cateogry based configuration items (similar to how logging categories are applied) that can be used to supercede the values passed via method parameter.
This utility type is generally intended for functional and end-to-end testing scenarios where waiting for a condition before proceeding is common.
The configuration object support is intended to allow manual test execution to override delay/wait values, so fast running automated tests are easier to follow by a human, without requiring changes to the actual test code.
Example Usage:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
using Rhinobyte.Extensions.TestTools;
using System;
using System.Threading;
using System.Threading.Tasks;
[TestClass]
public class YourTestClass
{
[TestMethod]
public async Task YourTestMethod()
{
var waitUtility = new WaitUtility();
if (File.Exists(waitConfigurationFilePath))
{
var jsonContent = await File.ReadAllTextAsync(waitConfigurationFilePath, CancellationTokenForTest);
var waitConfigurationDictionary = JsonConvert.DeserializeObject<Dictionary<string, WaitConfigurationItem>>(jsonConten);
waitUtility.Configuration = WaitConfiguration.FromDictionary(waitConfigurationDictionary);
}
await PrepareSomethingAsync(CancellationTokenForTest);
var somethingRequest = new SomethingRequest();
var something = await waitUtility
.WaitUntilAsync(GetSomethingAsync, somethingRequest, pollingInterval: 1000, timeoutThreshold: 30_000, waitId: "Some.Wait.Id", cancellationToken: CancellationTokenForTest);
// ... more test code ...
}
public static async Task<Something?> GetSomethingAsync(SomethingRequest request, CancellationToken cancellationToken)
{
if (notReadyYet)
return null;
return new Something();
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- MSTest.TestFramework (>= 3.0.0)
-
.NETStandard 2.0
- MSTest.TestFramework (>= 3.0.0)
-
.NETStandard 2.1
- MSTest.TestFramework (>= 3.0.0)
-
net6.0
- MSTest.TestFramework (>= 3.0.0)
-
net8.0
- MSTest.TestFramework (>= 3.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
8.0.0-preview.1 | 35 | 8/4/2024 |
1.0.0-rc.1 | 943 | 10/24/2021 |