TriasDev.Templify.Builder.Testing 0.1.0

Prefix Reserved
dotnet add package TriasDev.Templify.Builder.Testing --version 0.1.0
                    
NuGet\Install-Package TriasDev.Templify.Builder.Testing -Version 0.1.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="TriasDev.Templify.Builder.Testing" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TriasDev.Templify.Builder.Testing" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="TriasDev.Templify.Builder.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 TriasDev.Templify.Builder.Testing --version 0.1.0
                    
#r "nuget: TriasDev.Templify.Builder.Testing, 0.1.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.
#:package TriasDev.Templify.Builder.Testing@0.1.0
                    
#: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=TriasDev.Templify.Builder.Testing&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=TriasDev.Templify.Builder.Testing&version=0.1.0
                    
Install as a Cake Tool

TriasDev.Templify.Builder.Testing

Test kit for TriasDev.Templify.Builder. The builder generates templates at runtime, so your CI is where your template definitions get verified. The kit does not depend on a test framework: call it from xUnit, NUnit or MSTest.

Preview (0.x), experimental, like the builder: opt in with <NoWarn>$(NoWarn);TPLB001</NoWarn>.

[Fact]
public void InvoiceTemplate_IsValid() => TemplateVerifier.VerifyAll(
    () => new InvoiceTemplate(theme),
    new TemplateVerificationOptions
    {
        Languages = [CultureInfo.GetCultureInfo("de-DE"), CultureInfo.GetCultureInfo("en-US")],
        Texts = language => catalogs[language.Name],
        SampleData = [File.ReadAllText("invoice-sample.json")],
    });

VerifyAll builds the definition for every language and format and throws TemplateVerificationException, listing every failure, when one of these checks fails:

  • the definition builds;
  • ValidateTemplate reports no errors;
  • the data contract is complete: filling with the contract's witness raises no missing variable and no warning;
  • every sample data document fills without missing variables and without warnings;
  • the DOCX passes the OOXML schema validation, the ODT the package checks (template and filled documents);
  • a second build gives the same bytes, also under the current cultures tr-TR and ar-SA;
  • all languages and formats have the same data contract.

Verify returns the same TemplateVerificationReport without throwing. CheckTemplate, CheckFill and CheckPackage run single checks.

Snapshots

TemplateSnapshot.Create(template) returns a canonical text dump (paragraphs with their styles, markers, tables, headers and footers) for golden tests:

== body
Heading1 | Order {{order.number}}
TemplifyMarker | {{#if order.isPaid}}
Normal | Paid.
TemplifyMarker | {{/if}}

LibreOffice

LibreOfficeConverter converts templates and filled documents with a local LibreOffice (TEMPLIFY_SOFFICE or the default install path). Check LibreOfficeConverter.IsAvailable and skip the test otherwise.

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.  net11.0 is compatible. 
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
0.1.0 45 12/2/2026