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
<PackageReference Include="TriasDev.Templify.Builder.Testing" Version="0.1.0" />
<PackageVersion Include="TriasDev.Templify.Builder.Testing" Version="0.1.0" />
<PackageReference Include="TriasDev.Templify.Builder.Testing" />
paket add TriasDev.Templify.Builder.Testing --version 0.1.0
#r "nuget: TriasDev.Templify.Builder.Testing, 0.1.0"
#:package TriasDev.Templify.Builder.Testing@0.1.0
#addin nuget:?package=TriasDev.Templify.Builder.Testing&version=0.1.0
#tool nuget:?package=TriasDev.Templify.Builder.Testing&version=0.1.0
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;
ValidateTemplatereports 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 | Versions 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. |
-
net10.0
- DocumentFormat.OpenXml (>= 3.5.1)
- TriasDev.Templify.Builder (>= 0.1.0)
-
net11.0
- DocumentFormat.OpenXml (>= 3.5.1)
- TriasDev.Templify.Builder (>= 0.1.0)
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 |