Digitall.Testing 1.0.0-beta.13

This is a prerelease version of Digitall.Testing.
dotnet add package Digitall.Testing --version 1.0.0-beta.13
                    
NuGet\Install-Package Digitall.Testing -Version 1.0.0-beta.13
                    
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="Digitall.Testing" Version="1.0.0-beta.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Digitall.Testing" Version="1.0.0-beta.13" />
                    
Directory.Packages.props
<PackageReference Include="Digitall.Testing" />
                    
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 Digitall.Testing --version 1.0.0-beta.13
                    
#r "nuget: Digitall.Testing, 1.0.0-beta.13"
                    
#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 Digitall.Testing@1.0.0-beta.13
                    
#: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=Digitall.Testing&version=1.0.0-beta.13&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Digitall.Testing&version=1.0.0-beta.13&prerelease
                    
Install as a Cake Tool

DigitallStub

A .NET stub implementation for Microsoft Dataverse testing, providing a lightweight, in-memory IOrganizationService.

Features

  • FakeOrganizationService: In-memory implementation of IOrganizationService.
  • Query Support: Supports QueryExpression, QueryByAttribute, and FetchXml.
  • Request Fakes: Extensible architecture for mocking OrganizationRequest messages.
  • Early-Bound Support: Automatically discovers early-bound entity types via [assembly:ProxyTypesAssembly].
  • Plugin Testing: Utilities for building and testing Dataverse plugins (e.g., PluginExecutionContextBuilder).

Prerequisites

  • .NET SDK: Supports net462 and net10.0.
  • IDE: Rider or Visual Studio.

Setup & Build

  1. Restore Dependencies:
    dotnet restore
    
  2. Build Solution:
    dotnet build
    

Usage

Basic Example

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using AwesomeAssertions;
using Digitall.Testing;

[TestClass]
public class DataverseStubTests
{
    [TestMethod]
    public void Should_CreateAndRetrieveEntity()
    {
        // Arrange: Initialize the fake service
        var service = new FakeOrganizationService();
        var account = new Entity("account")
        {
            ["name"] = "Test Account"
        };

        // Act: Perform operations
        var id = service.Create(account);
        var retrieved = service.Retrieve("account", id, new ColumnSet("name"));

        // Assert: Verify results
        retrieved.Should().NotBeNull();
        retrieved["name"].Should().Be("Test Account");
    }
}

Early-Bound Entities

To use early-bound types, ensure your test assembly (or the assembly containing the types) has the ProxyTypesAssembly attribute:

[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssembly]

Testing

Tests are located in tests/Digitall.Testing.Tests.

  • Run all tests:
    dotnet test
    
  • Run specific tests:
    dotnet test --filter Name~YourTestName
    

Configuration (Environment Variables)

The FakeOrganizationService and its internal components can be influenced by the following environment variables:

Variable Description Default
MaxRetrieveCount Maximum number of records returned by RetrieveMultiple. 5000
UserId The ID of the current user (used in WhoAmI and EqualUserId filters). Guid.Empty
BusinessUnitId The ID of the current business unit. Guid.Empty
FiscalYearStart Start date for fiscal year calculations. Current Year Start

Project Structure

  • src/Digitall.Testing: Core library containing FakeOrganizationService.
    • Extensions: Utilities for Entities, QueryExpressions, etc.
    • OrganizationRequests: Custom fakes for specific OrganizationRequest types.
    • Logic: Internal logic for query processing and state management.
  • tests/Digitall.Testing.Tests: Unit tests for the library.

License

This project is licensed under the Microsoft Public License (MS-PL). See Licence.md for details.

Product 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. 
.NET Framework net462 is compatible.  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
1.0.0-beta.13 53 4/29/2026
1.0.0-beta.12 142 3/11/2026
1.0.0-beta.11 55 3/11/2026
1.0.0-beta.10 55 3/11/2026
1.0.0-beta.9 46 3/10/2026
1.0.0-beta.8 55 3/10/2026
1.0.0-beta.6 234 12/19/2025
1.0.0-beta.5 224 5/27/2025
1.0.0-beta.4 128 4/25/2025
1.0.0-beta.3 169 4/24/2025
1.0.0-beta.2 144 4/22/2025
1.0.0-beta.1 213 4/17/2025