XMapper.Testing
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package XMapper.Testing --version 1.0.0
NuGet\Install-Package XMapper.Testing -Version 1.0.0
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="XMapper.Testing" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add XMapper.Testing --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: XMapper.Testing, 1.0.0"
#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.
// Install XMapper.Testing as a Cake Addin #addin nuget:?package=XMapper.Testing&version=1.0.0 // Install XMapper.Testing as a Cake Tool #tool nuget:?package=XMapper.Testing&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
XMapper.Testing
Automate the testing of all your object-to-object mappers with one line of unit test code <p align="center"> <img src="https://avatars.githubusercontent.com/u/103217522?s=150&v=4" alt="XMapper logo"/> </p> Available via NuGet.
Example
- Define your mappers as static fields or static properties:
using XMapper;
namespace DummyAssembly1;
public class Class1
{
public static XMapper<DummyA, DummyB> MapperField =
new XMapper<DummyA, DummyB>(PropertyList.Target); // Should fail: DummyB.XString has no match.
}
public class DummyA
{
public int XInt { get; set; } = 1;
}
public class DummyB
{
public int XInt { get; set; } = 2;
public string XString { get; set; } = "B";
}
- Test all mappers via a single method call inside a unit test:
using XMapper.Testing;
using Xunit;
public class MyXMapperTests
{
[Fact]
public void AllAreValid()
{
AssertXMapper.AllAreValidInAssembly("DummyAssembly1"));
}
}
All assert options
using XMapper.Testing;
// and inside a unit test method, call one of these:
AssertXMapper.AllAreValidInAssembly("Project1"));
AssertXMapper.AllAreValidInAssemblies("MyProject1", "MyProject2");
AssertXMapper.AllAreValidInAssembly(Assembly.Load("AnotherAssembly"));
AssertXMapper.AllAreValidInAssemblies(Assembly.Load("MyAssembly1"), Assembly.Load("MyAssembly2"));
// or only validate specific mappers:
AssertXMapper.IsValid(mapper);
mapper.IsValid(); // extension method
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net5.0
- XMapper (>= 1.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.