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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Net4x.BaseUnitTest" Version="2.5.0.26287" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Net4x.BaseUnitTest" Version="2.5.0.26287" />
                    
Directory.Packages.props
<PackageReference Include="Net4x.BaseUnitTest" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Net4x.BaseUnitTest --version 2.5.0.26287
                    
#r "nuget: Net4x.BaseUnitTest, 2.5.0.26287"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Net4x.BaseUnitTest@2.5.0.26287
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Net4x.BaseUnitTest&version=2.5.0.26287
                    
Install as a Cake Addin
#tool nuget:?package=Net4x.BaseUnitTest&version=2.5.0.26287
                    
Install as a Cake Tool

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:

  • AppConfigFactoryUtility wraps an IAppConfigFactory for the base classes.
  • ArgumentGetterUtility wraps an IArgumentGetterBaseGetSet<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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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