BlueDotBrigade.DatenLokator 2.5.0

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

Daten Lokator

.NET CodeQL

Overview

BlueDotBrigade.DatenLokator is a .NET NuGet package that streamlines automated testing by allowing you to load input data with a single line of code, thus reducing visual noise and improving test comprehension. This library supports multiple data formats, automatic decompression, global caching, and run-time customization.

Features

  1. Retrieve data in different formats:
    • AsBytes()
    • AsFile()
    • AsString()
    • AsStream()
    • AsStreamReader()
    • AsJson()
  2. Automatic decompression of archives: *.zip, *.7z, *.tar
  3. Global cache support.
    • Useful when multiple tests consume the same file as input.
  4. Run-time customization.
    • Can be used to specify where the input data will be stored.
  5. Extensible library.

Getting Started

Setup:

  1. Create a .NET automated test project.
    • For example: Using Visual Studio add a MsTest Test Project to your solution.
    • Daten Lokator will work with: MsTest, NUnit, XUnit, etc.
  2. Add the latest NuGet package to your test project:
  3. The Daten Lokator library must be initialized only once when the automated tests start.
    • Example: Lokator.Get().Setup()
    • If you are using MsTest then consider doing this where the AssemblyInitialize attribute is used.
  4. Create a.Daten folder within the project (*.csproj) directory.
    • Example: /DemoTests/.Daten
    • Storing the input data within the project directory provides traceability, because now the input data can be committed to source control (e.g. GitHub).

Test data sources and mock endpoints:

  • Instances of Daten can be used to load deterministic input fixtures from disk.
  • Lokator.Register() can be used to setup lightweight sockets that serve static content — useful for testing HTTP clients without an external server.

Managing source files:

  1. Create an automated test.
    • By default it is assumed that test method name follows the Assert Act Arrange naming convention.
  2. Save the input data in a file directory structure that mirrors the namespace.
    • For example:
      • Unit Tests: /DemoTests/Serialization/XmlSerializerTests.cs
      • Input Data: /DemoTests/.Daten/Serialization/XmlSerializerTests/*.*
    • Where:
      • .Daten is Daten Lokator's root directory for all input files.
      • Serialization is the namespace where the XmlSerializerTests.cs automated tests can be found.
  3. When an input file is needed, simply call the appropriate Daten method from your automated test.
    • For example: new Daten().AsString()

Compressed Input Data

Input data can be stored in an archive. Supported formats: *.zip, *.7z, *.tar

  1. When Lokator.Get().Setup() runs, each archive under .Daten is decompressed into a sibling directory whose name ends with ~TMP.
    • For example: .Daten/Serialization/XmlSerializerTests.zip is decompressed into .Daten/Serialization/XmlSerializerTests~TMP/
  2. Daten then searches the ~TMP directory as though it were the test's own directory.
    • Global data: when a test asks for LargeFile.txt, .Daten/.Global/LargeFile~TMP/ is searched, which holds the content of .Daten/.Global/LargeFile.zip
  3. The ~TMP directory is kept between test runs, so an archive is only decompressed once.
    • After changing an archive, delete its ~TMP directory so that it is decompressed again.
  4. Add *~TMP/ to your .gitignore file, so that decompressed files are not committed to source control.

Sample Code

The daten-lokator-demo repository contains a complete, runnable example: unit tests, written for a trivial application, that use the published NuGet package and demonstrate how:

  1. easy it is to use Daten Lokator, and
  2. how the library reduces visual noise thus making the test easier to read

Upgrading to 2.5.0

  1. Your test project must target .NET 10 (net10.0) or later.
  2. Archives are now decompressed into <name>~TMP/ instead of <name>~ZIP/.
    • In your .gitignore file, replace *~ZIP/ with *~TMP/.
    • Delete any ~ZIP directories that are left under .Daten.

The Change Log lists every change in this release.

Creating the Package

From the repository's root folder, create the NuGet package with:

dotnet pack -c Release

In Visual Studio, select the Release configuration, then right-click the project and choose Pack.

  • The package is saved in Src/BlueDotBrigade.DatenLokator.TestTools/bin/x64/Release.
  • Only a pack creates the package. A build does not, even in Release.
  • Packing in Debug stops with an error, so a package built without optimization cannot be published by mistake.
  • The debugging information (PDB) is embedded in the DLL, so stack traces still show file names and line numbers.
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

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
2.5.0 1,148 11/14/2026

This library is currently a work in progress (WIP). As a result, backwards compatibility is not guaranteed. Change log: https://github.com/BlueDotBrigade/daten-lokator/blob/main/ChangeLog.md