AurorisNet.Umbraco.AppBlocks.Testing 0.1.0-alpha.2

This is a prerelease version of AurorisNet.Umbraco.AppBlocks.Testing.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package AurorisNet.Umbraco.AppBlocks.Testing --version 0.1.0-alpha.2
                    
NuGet\Install-Package AurorisNet.Umbraco.AppBlocks.Testing -Version 0.1.0-alpha.2
                    
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="AurorisNet.Umbraco.AppBlocks.Testing" Version="0.1.0-alpha.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AurorisNet.Umbraco.AppBlocks.Testing" Version="0.1.0-alpha.2" />
                    
Directory.Packages.props
<PackageReference Include="AurorisNet.Umbraco.AppBlocks.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 AurorisNet.Umbraco.AppBlocks.Testing --version 0.1.0-alpha.2
                    
#r "nuget: AurorisNet.Umbraco.AppBlocks.Testing, 0.1.0-alpha.2"
                    
#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 AurorisNet.Umbraco.AppBlocks.Testing@0.1.0-alpha.2
                    
#: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=AurorisNet.Umbraco.AppBlocks.Testing&version=0.1.0-alpha.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=AurorisNet.Umbraco.AppBlocks.Testing&version=0.1.0-alpha.2&prerelease
                    
Install as a Cake Tool

AppBlocks Testing

AurorisNet.Umbraco.AppBlocks.Testing drives the AppBlocks endpoints of a running site over HTTP, as the browser runtime does. A test can load, create, update and delete form records, upload attachments, save tabular rows and read reports. The package also has helpers for running Umbraco in a test process.

Install

Add the package to the site's test project. It depends on AurorisNet.Umbraco.AppBlocks, so use the version that matches the site's AppBlocks version. It is an alpha and is not on nuget.org yet. The repository README describes how to reference it until it is.

dotnet add package AurorisNet.Umbraco.AppBlocks.Testing --version 0.1.0-alpha.1

The package references no test framework. A call that cannot be made, such as a write before the load that supplies its antiforgery token, throws TestSiteException with what was observed.

Clients

Each client takes an HttpClient that keeps cookies and the site's virtual path, which is empty at the root. The form, attachment and tabular clients also take the keys of the page and the block they drive.

Client Endpoint Methods
FormsClient /api/forms/{page}/{form} LoadAsync, CreateAsync, UpdateAsync, DeleteAsync. Answers are a FormResponse with RecordKey, RecordChecksum, Values and Errors
AttachmentsClient /api/attachments/{page}/{block} ListAsync, UploadAsync with an AttachmentFile, RenameAsync, DownloadAsync, RemoveAsync
TabularClient /api/tabular/{page}/{block} ListAsync, and SaveAsync with a batch of TabularChange
ReportsClient /api/reports, /api/download SchemaAsync, RowsAsync, and DownloadAsync in a format such as csv
PaperReportsClient /api/paper-reports/{node} DownloadAsync of a Document node of the Documents package

Load or list before the first write, and again wherever a browser would reload the page. A write carries the antiforgery token and the definition version that the last load returned. Page parameters, such as the record key a block follows, go in the query argument of each call.

using AppBlocks.Testing;

var forms = new FormsClient(client, pathBase: "", pageKey, formKey);
var loaded = await forms.LoadAsync();
var created = await forms.CreateAsync(new { customer = "Ada", quantity = 2 });
var updated = await forms.UpdateAsync(created.RecordKey!, created.RecordChecksum, new { quantity = 3 });

Running Umbraco in a test process

UmbracoTestSupport works with any way of starting the site:

  • UseSingleServer(services) replaces server election, whose writes can race a SQLite startup import.
  • WaitForInstallAsync(services) waits, after the host has started, for the unattended install or upgrade, and then for RuntimeLevel.Run and content routing.
  • ResetBackOfficePath() and ResetPublishedContentServices() clear static state that Umbraco keeps from the first site, so a later site in the same process starts clean. Run one site at a time.

A test process that starts Umbraco must exclude its test runner's assemblies from Umbraco's type scan. For xUnit, add xunit. to Umbraco:CMS:TypeFinder:AdditionalAssemblyExclusionEntries.

To start a whole AppHost site, use AurorisNet.Umbraco.AppHost.Testing, whose TestSite creates these clients for its own address and virtual path.

License

MIT

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on AurorisNet.Umbraco.AppBlocks.Testing:

Package Downloads
AurorisNet.Umbraco.AppHost.Testing

Boots an UmbracoAppHost site in a test process: the host's own registrations on Kestrel at a free loopback port, with a fresh SQLite database and instance folder, and signs in members and backoffice users. No test framework dependency; failures throw TestSiteException.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-alpha.6 0 11/20/2026
0.1.0-alpha.5 13 11/19/2026
0.1.0-alpha.4 34 11/19/2026
0.1.0-alpha.3 37 11/19/2026
0.1.0-alpha.2 41 11/18/2026
0.1.0-alpha.1 57 11/18/2026