Pillaro.Dataverse.PluginFramework.Testing
1.2.0
Prefix Reserved
dotnet add package Pillaro.Dataverse.PluginFramework.Testing --version 1.2.0
NuGet\Install-Package Pillaro.Dataverse.PluginFramework.Testing -Version 1.2.0
<PackageReference Include="Pillaro.Dataverse.PluginFramework.Testing" Version="1.2.0" />
<PackageVersion Include="Pillaro.Dataverse.PluginFramework.Testing" Version="1.2.0" />
<PackageReference Include="Pillaro.Dataverse.PluginFramework.Testing" />
paket add Pillaro.Dataverse.PluginFramework.Testing --version 1.2.0
#r "nuget: Pillaro.Dataverse.PluginFramework.Testing, 1.2.0"
#:package Pillaro.Dataverse.PluginFramework.Testing@1.2.0
#addin nuget:?package=Pillaro.Dataverse.PluginFramework.Testing&version=1.2.0
#tool nuget:?package=Pillaro.Dataverse.PluginFramework.Testing&version=1.2.0
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 = TestDataService.CreateTestEntity(contact);
var loaded = TestDataService
.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 licensed under the Apache License, Version 2.0. See the LICENSE file for details.
| 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.Caching.Memory (>= 8.0.1)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 8.0.0)
- Microsoft.Extensions.Configuration.Json (>= 8.0.0)
- Microsoft.PowerPlatform.Dataverse.Client (>= 1.2.10)
- Pillaro.Dataverse.PluginFramework (>= 1.2.0)
- xunit.v3.extensibility.core (>= 3.2.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.0 | 86 | 9/9/2026 |
| 1.2.0-rc.569 | 62 | 9/6/2026 |
| 1.2.0-rc.559 | 60 | 9/6/2026 |
| 1.1.3-rc.550 | 60 | 9/5/2026 |
| 1.1.3-rc.542 | 57 | 9/4/2026 |
| 1.1.2 | 89 | 8/31/2026 |
| 1.1.1 | 127 | 7/27/2026 |
| 1.1.1-rc.428 | 59 | 7/20/2026 |
| 1.1.0 | 143 | 6/7/2026 |
| 1.1.0-rc.257 | 73 | 6/2/2026 |
| 1.1.0-rc.252 | 63 | 6/2/2026 |
| 1.1.0-rc.248 | 68 | 6/1/2026 |
| 1.1.0-rc.244 | 67 | 6/1/2026 |
| 1.0.2 | 109 | 5/6/2026 |
| 1.0.2-rc.141 | 63 | 5/4/2026 |
| 1.0.1-rc.115 | 71 | 4/14/2026 |
| 1.0.1-rc.114 | 76 | 4/14/2026 |
| 1.0.1-ci.109 | 83 | 4/12/2026 |
| 1.0.0-ci.108 | 75 | 4/12/2026 |
| 1.0.0-ci.107 | 76 | 4/11/2026 |