Pillaro.Dataverse.PluginFramework.Testing
1.0.2
Prefix Reserved
See the version list below for details.
dotnet add package Pillaro.Dataverse.PluginFramework.Testing --version 1.0.2
NuGet\Install-Package Pillaro.Dataverse.PluginFramework.Testing -Version 1.0.2
<PackageReference Include="Pillaro.Dataverse.PluginFramework.Testing" Version="1.0.2" />
<PackageVersion Include="Pillaro.Dataverse.PluginFramework.Testing" Version="1.0.2" />
<PackageReference Include="Pillaro.Dataverse.PluginFramework.Testing" />
paket add Pillaro.Dataverse.PluginFramework.Testing --version 1.0.2
#r "nuget: Pillaro.Dataverse.PluginFramework.Testing, 1.0.2"
#:package Pillaro.Dataverse.PluginFramework.Testing@1.0.2
#addin nuget:?package=Pillaro.Dataverse.PluginFramework.Testing&version=1.0.2
#tool nuget:?package=Pillaro.Dataverse.PluginFramework.Testing&version=1.0.2
Pillaro.Dataverse.PluginFramework.Testing
A testing package focused on integration testing for Microsoft Dataverse solutions.
The package provides a structured and maintainable approach to testing Dataverse logic using real data, deterministic execution and automatic cleanup.
What this package provides
- Infrastructure for integration testing against Microsoft Dataverse
- Test
DataServicefor working with Dataverse in test scenarios - Repository-based test data preparation
- Automatic creation and cleanup of test data
- Handling of referenced data that cannot be deleted directly
- Structured test setup using fixtures and dependency injection
Why use it
- Reduce complexity of Dataverse integration tests
- Keep test data consistent and reusable
- Automatically clean up test data after execution
- Handle complex cleanup scenarios (relationships, references)
- Improve long-term maintainability of test suite
- Keep tests focused on behavior, not infrastructure
Testing approach
Each test follows a deterministic lifecycle:
- Prepare data using repositories
- Create data in Dataverse via
DataService - Execute tested logic (plugin / business operation)
- Verify result
- Automatically clean up all created data
This ensures tests are isolated, predictable and maintainable.
Project structure (recommended)
Repositories/
Reusable test data definitionsTests/
Test scenarios (behavior only)TestBase / Fixtures
Shared setup (DI, lifecycle)Infrastructure/Dataverse/
TestDataService, cleanup, Dataverse accessAutoFacModule
Dependency registration
Core concepts
TestDataService
Central entry point for test interaction with Dataverse.
- creates entities
- tracks created data
- provides querying
- ensures cleanup
Data repositories
Encapsulate test data creation.
- reusable
- centralized
- resilient to schema changes
Automatic cleanup
- deletes all created data
- handles referenced entities
- prevents test pollution
Autofac configuration
Tests use Autofac for dependency injection.
public class TestAutofacModule : Module
{
protected override void Load(ContainerBuilder builder)
{
builder.RegisterModule<FrameworkTestingAutofacModule>();
builder.RegisterAssemblyTypes(GetType().Assembly)
.Where(t => t.GetInterfaces().Any(i => i.IsAssignableFrom(typeof(IAutoRegisteredTestDataRepository))))
.AsSelf();
}
}
Custom TestBase
You can extend the base test class to include your own services:
public class TestBase : TestBase<TestAutofacModule>
{
protected readonly SettingsService SettingService;
public TestBase(TestFixture<TestAutofacModule> testFixture, ITestOutputHelper output)
: base(testFixture, output)
{
SettingService = testFixture.Container.Resolve<SettingsService>();
}
}
Example test class
[Trait("Owner", "JM")]
[Trait("Category", nameof(TestTask))]
public class TestTaskTest(TestFixture<TestAutofacModule> testFixture, ITestOutputHelper output) : TestBase(testFixture, output)
{
[Fact]
public void Valid_Firstname_And_Lastname()
{
var contact = new Contact
{
FirstName = "Jan",
LastName = "Mucha"
};
contact.Id = DataService.CreateTestEntity(contact);
var loaded = DataService
.Query<Contact>()
.Where(x => x.Id == contact.Id)
.Select(x => new Contact { FirstName = x.FirstName, LastName = x.LastName })
.First();
Assert.Equal(contact.FirstName, loaded.FirstName);
Assert.Equal(contact.LastName, loaded.LastName);
}
}
Recommended test structure
Each test should:
- use repositories for data preparation
- use
TestDataServicefor all Dataverse interaction - focus only on behavior validation
- rely on automatic cleanup
Avoid:
- manual entity construction inside tests
- manual cleanup logic
- duplicated data setup
Maintainability strategy
The package is designed to reduce long-term cost of test maintenance:
- centralized data definitions (repositories)
- deterministic execution
- automatic cleanup
Result:
- easier refactoring
- lower maintenance cost
- higher clarity
Where to find more
License
This project is published under the Pillaro Community License (PCL) v1.0.
Attribution is required when the framework is used in delivered solutions:
"This solution is built using Pillaro Dataverse Plugin Framework."
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net8.0
- Autofac (>= 9.1.0)
- Microsoft.Extensions.Configuration.Json (>= 10.0.5)
- Pillaro.Dataverse.PluginFramework (>= 1.0.2)
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 |
|---|---|---|
| 1.2.2 | 62 | 9/12/2026 |
| 1.2.0 | 105 | 9/9/2026 |
| 1.2.0-rc.569 | 66 | 9/6/2026 |
| 1.2.0-rc.559 | 66 | 9/6/2026 |
| 1.1.3-rc.550 | 66 | 9/5/2026 |
| 1.1.3-rc.542 | 61 | 9/4/2026 |
| 1.1.2 | 94 | 8/31/2026 |
- Release candidate for the next testing package release.
- Core testing documentation structure has been prepared and aligned with the current testing architecture.
- Testing behavior is being validated before final release.