Portamical 2.0.0
See the version list below for details.
dotnet add package Portamical --version 2.0.0
NuGet\Install-Package Portamical -Version 2.0.0
<PackageReference Include="Portamical" Version="2.0.0" />
<PackageVersion Include="Portamical" Version="2.0.0" />
<PackageReference Include="Portamical" />
paket add Portamical --version 2.0.0
#r "nuget: Portamical, 2.0.0"
#:package Portamical@2.0.0
#addin nuget:?package=Portamical&version=2.0.0
#tool nuget:?package=Portamical&version=2.0.0
Portamical
Shared utilities and base classes for cross-framework test data solutions in .NET.
Portamical provides framework-agnostic converters, assertions, and test base classes that bridge between Portamical.Core and framework-specific adapters.
Install
dotnet add package Portamical
Note: Most users should install a framework adapter instead:
Portamical.xUnitfor xUnit v2Portamical.xUnit_v3for xUnit v3Portamical.MSTestfor MSTest 4Portamical.NUnitfor NUnit 4
What's New
Thread Safety Enhancement: Removed Static TestBase.ArgsCode Property
In v1.x, the static TestBase.ArgsCode property created race conditions during parallel test execution:
// v1.x ? RACE CONDITION EXAMPLE
// Thread 1: Set ArgsCode to Properties
TestBase.ArgsCode = AsProperties;
// Thread 2: Simultaneously sets ArgsCode to Instance (OVERWRITES Thread 1)
TestBase.ArgsCode = AsInstance;
// Thread 1: Convert reads ArgsCode.Instance (WRONG VALUE)
var args = Convert(dataSource.GetArgs()); // Uses Instance instead of Properties
v2.0 Solution: New ConvertAsInstance method
In v2.0, ConvertAsInstance is a convenience helper for instance-mode conversion that avoids the v1.x static ArgsCode state and keeps conversions thread-safe.
// v2.0
var args = ConvertAsInstance(convert, testDataCollection, testMethodName);
Equivalent to: invoking the adapter-supplied conversion delegate with ArgsCode.Instance.
Migration:
- Remove all
ArgsCodestatic field assignments - Pass
ArgsCodeas parameter toConvert()methods - Default behavior unchanged (uses
ArgsCode.Instance)
What's Included
Converters
Transform test data collections into framework-consumable formats:
using Portamical.Converters;
// Convert to object arrays with automatic deduplication
var args = testDataCollection.ToDistinctReadOnly(ArgsCode.Instance);
var argsFlattened = testDataCollection.ToDistinctReadOnly(ArgsCode.Properties);
Assertions
Framework-agnostic assertion helpers with delegate injection:
using static Portamical.Assertions.PortamicalAssert;
// xUnit
ThrowsDetails(
attempt: () => MethodUnderTest(),
expected: new ArgumentNullException("paramName"),
catchException: Record.Exception,
assertIsType: Assert.IsType,
assertEquality: Assert.Equal,
assertFail: Assert.Fail);
// MSTest
ThrowsDetails(
attempt,
expected,
catchException: CatchException,
assertIsType: (e, a) => Assert.AreEqual(e, a.GetType()),
assertEquality: (e, a) => Assert.AreEqual(e, a),
assertFail: Assert.Fail);
Test Bases
Three specialized base classes for different conversion strategies:
Strategy 1: TestData Collection (Type-Safe)
using Portamical.TestBases.TestDataCollection;
public class MyTests : TestBase
{
protected static IReadOnlyCollection<TestData<DateOnly>> Args
=> Convert(dataSource.GetArgs());
}
Returns: IReadOnlyCollection<TestData<T>> with automatic deduplication.
Strategy 2: Instance Array (Object Wrapper)
using Portamical.TestBases.ObjectArrayCollection;
public class MyTests : TestBase
{
private static IReadOnlyCollection<object?[]> Args
=> Convert(dataSource.GetArgs()); // ArgsCode.Instance default
[TestMethod, DynamicData(nameof(Args))]
public void Test(TestData<DateOnly> testData) { ... }
}
Returns: IReadOnlyCollection<object?[]> where each array contains [testData].
Strategy 3: Flattened Properties Array
using Portamical.TestBases.ObjectArrayCollection;
public class MyTests : TestBase
{
public static IReadOnlyCollection<object?[]> Args
=> Convert(dataSource.GetArgs(), AsProperties);
[Theory, MemberData(nameof(Args))]
public void Test(DateOnly arg1, BirthDay arg2) { ... }
}
Returns: IReadOnlyCollection<object?[]> where each array contains [arg1, arg2, ...].
ArgsCode Strategy Pattern
| Strategy | Produces | Test Method Signature | Base Class |
|---|---|---|---|
| No ArgsCode | IReadOnlyCollection<TTestData> |
void Test(TestData<T> data) |
TestDataCollection.TestBase |
AsInstance (default) |
IReadOnlyCollection<object?[]> with [testData] |
void Test(TestData<T> data) |
ObjectArrayCollection.TestBase |
AsProperties |
IReadOnlyCollection<object?[]> with [arg1, arg2, ...] |
void Test(T arg1, T arg2, ...) |
ObjectArrayCollection.TestBase |
Links
- GitHub: https://github.com/CsabaDu/Portamical
- Documentation: https://github.com/CsabaDu/Portamical/blob/master/README.md
- Issues: https://github.com/CsabaDu/Portamical/issues
License and Project Lineage
This project is licensed under the MIT License.
Portamical is the continuation and successor of CsabaDu.DynamicTestData.Light and CsabaDu.DynamicTestData (also MIT-licensed).
CsabaDu.DynamicTestData.Light and CsabaDu.DynamicTestData are considered legacy and are no longer supported; new development happens in Portamical.
Changelog
Version 2.0.0 (2026-03-13)
Breaking Changes
- Removed:
TestBase.ArgsCodestatic property (thread safety issue)
Major Enhancements
Comprehensive XML Documentation
- Added extensive XML documentation comments across the entire codebase (65 files updated)
- Documented design patterns (Template Method, Strategy, Facade, Decorator)
- Added detailed usage examples with code samples for all public APIs
- Enhanced documentation for three distinct
TestBasestrategies
Core Infrastructure Improvements
ConvertAsInstanceHelper Methods:- Added protected helper methods in base
TestBaseclass - Enables framework adapters to default to
ArgsCode.Instancestrategy - Two overloads: with/without
testMethodNameparameter - Thread-safe design (stateless implementation)
- Added protected helper methods in base
TestBases.TestBase(Base Class):- Added
AsInstance,AsProperties,WithTestCaseNameconstants - Added
ConvertAsInstance<TTestData, T>protected helper methods - Serves as foundation for framework-agnostic conversion utilities
- Added
TestBases.TestDataCollection.TestBase:- Provides
Convert<TTestData>returningIReadOnlyCollection<TTestData> - Automatic deduplication via
ToDistinctArray()extension - Designed for type-safe test data collection handling
- Provides
TestBases.ObjectArrayCollection.TestBase:- Provides
Convert<TTestData>with optionalArgsCodeparameter - Two-parameter:
Convert(data, argsCode)for explicit strategy - One-parameter:
Convert(data)defaults toArgsCode.Instance - Returns
IReadOnlyCollection<object?[]>for framework compatibility
- Provides
Documentation & Code Quality
- Enhanced code comments explaining the three-strategy approach
- Improved method naming consistency across base classes
- Added comprehensive examples for each strategy
- Clarified inheritance relationships between
TestBaseclasses
Version 1.0.0 (2026-03-06)
- Initial release
- Framework-agnostic converters
PortamicalAssertwith delegate injection- Abstract
TestBaseclasses - Strategy Pattern support with
ArgsCodeenum
Version 1.0.1 (2026-03-07)
- Moved xunit.runner.json from Portamical to xUnit adapter packages
- Improved GlobalUsings.cs organization
Version 1.0.2 (2026-03-08)
- Implemented standard
IDisposablepattern inPortamical.TestBases.TestBase
Made by CsabaDu
Portamical: Test data as a domain, not an afterthought.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Portamical.Core (>= 2.0.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Portamical:
| Package | Downloads |
|---|---|
|
Portamical.xUnit_v3
xUnit v3 adapter for Portamical: Universal, identity-driven test data modeling for .NET. |
|
|
Portamical.MSTest
MSTest 4 adapter for Portamical: Universal, identity-driven test data modeling for .NET. |
|
|
Portamical.xUnit
xUnit v2 adapter for Portamical: Universal, identity-driven test data modeling for .NET. |
|
|
Portamical.NUnit
NUnit 4 adapter for Portamical: Universal, identity-driven test data modeling for .NET. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Breaking Changes:
- TestBase.ArgsCode` static property removed (thread safety issue).
Major Enhancements:
- Comprehensive XML Documentation,
- Core Infrastructure Improvements,
- Documentation & Code Quality