Net4x.BaseUnitTest
2.5.0.26287
dotnet add package Net4x.BaseUnitTest --version 2.5.0.26287
NuGet\Install-Package Net4x.BaseUnitTest -Version 2.5.0.26287
<PackageReference Include="Net4x.BaseUnitTest" Version="2.5.0.26287" />
<PackageVersion Include="Net4x.BaseUnitTest" Version="2.5.0.26287" />
<PackageReference Include="Net4x.BaseUnitTest" />
paket add Net4x.BaseUnitTest --version 2.5.0.26287
#r "nuget: Net4x.BaseUnitTest, 2.5.0.26287"
#:package Net4x.BaseUnitTest@2.5.0.26287
#addin nuget:?package=Net4x.BaseUnitTest&version=2.5.0.26287
#tool nuget:?package=Net4x.BaseUnitTest&version=2.5.0.26287
Net4x.BaseUnitTest
Reusable test base classes for configuration and ArgumentGetter implementations built on the
Net4x CoreLibrary contracts. The same read, write, parts and typed-value scenarios can run
against XML, JSON and URI configurations. The tests work with any test framework, because
assertions go through Tests.Base.AssertContainer.
Installation
dotnet add package Net4x.BaseUnitTest
Target frameworks: net45, net5.0, net6.0, net7.0, net8.0.
The package adds build/Net4x.BaseUnitTest.targets, which turns on
AutoGenerateBindingRedirects for the consuming test project.
Base classes (BaseUnitTest.BaseClasses)
| Class | Scenarios |
|---|---|
UnitTestBase |
Points the XML/JSON configurations at the test assembly and the URI configuration at http://localhost |
ConfigUnitTestBase |
DoConfigReadTest, DoConfigWriteTest, DoConfigPartsTest |
ArgumentGetterBaseTest |
DoGetValueTest, DoGetIntegerTest, DoGetBooleanTest, DoGetPartsTest, DoGetModifiedValueTest |
UriArgumentGetterBaseTest |
The same scenarios against a Uri query string, plus DoGetToUriTest |
TemporaryFileNameUtility |
Instance.GetTemporaryFileName(extension, useTempFolder) |
Helpers in BaseUnitTest.Utility:
AppConfigFactoryUtilitywraps anIAppConfigFactoryfor the base classes.ArgumentGetterUtilitywraps anIArgumentGetterBaseGetSet<Uri, string>.
Usage (xUnit)
using BaseUnitTest.BaseClasses;
using BaseUnitTest.Utility;
using ConfigurationLibrary.Configuration;
using ConfigurationLibrary.Configuration.Xml;
using CoreLibrary.Configuration;
using Xunit;
public class AppConfigUnitTest : ConfigUnitTestBase
{
public AppConfigUnitTest() : base(
new AppConfigFactoryUtility(AppConfigFactory.Instance), AppConfig.Instance, null,
typeof(IAppConfig), typeof(IJsonConfig), typeof(IUriConfig))
{
}
[Fact] public void Read() => DoConfigReadTest(typeof(IAppConfig));
[Fact] public void Parts() => DoConfigPartsTest(typeof(IAppConfig));
}
Expected test data
The scenarios assume the configuration under test contains:
| Key | Value |
|---|---|
One |
1 |
Two |
2 |
Plugin / Plugins |
a value with parts, for example exe\|Type\|Assembly |
Keep these keys in the test project's <assembly>.dll.config / <assembly>.json, copied to the
output folder.
Copyright (c) Piero Viano. All rights reserved. Authors: Piero Viano
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 is compatible. 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 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.5
- Net4x.CoreLibrary.Base (>= 2.5.0.26286)
- Net4x.Tests.Base (>= 1.5.0.26263)
- Newtonsoft.Json (>= 13.0.4)
-
net5.0
- Net4x.CoreLibrary.Base (>= 2.5.0.26286)
- Net4x.Tests.Base (>= 1.5.0.26263)
- Newtonsoft.Json (>= 13.0.4)
-
net6.0
- Net4x.CoreLibrary.Base (>= 2.5.0.26286)
- Net4x.Tests.Base (>= 1.5.0.26263)
- Newtonsoft.Json (>= 13.0.4)
-
net7.0
- Net4x.CoreLibrary.Base (>= 2.5.0.26286)
- Net4x.Tests.Base (>= 1.5.0.26263)
- Newtonsoft.Json (>= 13.0.4)
-
net8.0
- Net4x.CoreLibrary.Base (>= 2.5.0.26286)
- Net4x.Tests.Base (>= 1.5.0.26263)
- Newtonsoft.Json (>= 13.0.4)
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 |
|---|---|---|
| 2.5.0.26287 | 111 | 10/15/2026 |
| 2.5.0.26236 | 140 | 8/24/2026 |
| 2.5.0.5 | 152 | 7/17/2026 |
| 2.5.0.4 | 188 | 2/2/2026 |
| 2.5.0.3 | 177 | 1/23/2026 |
| 2.5.0.2 | 181 | 1/5/2026 |
| 2.5.0.1 | 182 | 12/30/2025 |
| 2.5.0 | 308 | 11/9/2025 |
| 1.6.0 | 317 | 4/4/2025 |
| 1.3.0 | 321 | 8/26/2023 |
| 1.3.0-at20230505032400 | 273 | 5/7/2023 |