Superdev.AspNetCore.Testing 1.0.6-pre

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

Superdev.AspNetCore

Version Downloads Buy Me a Coffee

Superdev.AspNetCore provides reusable, low-dependency building blocks for ASP.NET Core applications. It focuses on pragmatic infrastructure code which can be shared across projects.

Download and Install Superdev.AspNetCore

This library is available on NuGet: https://www.nuget.org/packages/Superdev.AspNetCore Use the following command to install Superdev.AspNetCore using NuGet package manager console:

PM> Install-Package Superdev.AspNetCore

You can use this library in ASP.NET Core projects compatible to .NET 9 and higher.

App Setup

tbd

API Usage

The following documentation covers the reusable building blocks that are already available in this package.

Use claim-based authorization

AuthorizeClaimAttribute allows you to protect endpoints based on the existence or value of claims.

Require a claim to exist:

using Superdev.AspNetCore.Security;

[AuthorizeClaim("permission")]
[HttpGet("profile")]
public IActionResult GetProfile()
{
    return this.Ok();
}

Require a specific claim value:

using Superdev.AspNetCore.Security;

[AuthorizeClaim("permission", "admin")]
[HttpDelete("{id}")]
public IActionResult Delete(int id)
{
    return this.NoContent();
}

Use more advanced matching with ClaimRequirementType:

using Superdev.AspNetCore.Security;

[AuthorizeClaim(ClaimRequirementType.Any, "permission", "read", "write")]
[HttpGet]
public IActionResult Get()
{
    return this.Ok();
}
Use writable options

ConfigureWritable<T> registers a configuration section as normal options and as IWritableOptions<T>. IWritableOptions<T> can update and persist the section back to appsettings.json.

Register writable options:

using Superdev.AspNetCore.Infrastructure.Configuration;

builder.Services.ConfigureWritable<MyFeatureOptions>(
    builder.Configuration.GetSection("MyFeature"));

Update options at runtime:

public class MyController : ControllerBase
{
    private readonly IWritableOptions<MyFeatureOptions> options;

    public MyController(IWritableOptions<MyFeatureOptions> options)
    {
        this.options = options;
    }

    [HttpPost("enable")]
    public async Task<IActionResult> EnableAsync()
    {
        await this.options.UpdatePropertyAsync(x => x.Enabled, true);
        return this.Ok();
    }
}

Writable options modify the configured JSON file on disk. Use this feature intentionally and avoid exposing it through unprotected endpoints.

Use system abstractions

This package contains lightweight abstractions for system services which make business code easier to test.

Inject IDateTime:

using Superdev.AspNetCore.Services.SystemAbstractions;

public class TokenService
{
    private readonly IDateTime dateTime;

    public TokenService(IDateTime dateTime)
    {
        this.dateTime = dateTime;
    }

    public DateTime GetExpirationUtc()
    {
        return this.dateTime.UtcNow.AddHours(1);
    }
}

Inject IFileSystem:

using Superdev.AspNetCore.Services.SystemAbstractions;

public class DocumentService
{
    private readonly IFileSystem fileSystem;

    public DocumentService(IFileSystem fileSystem)
    {
        this.fileSystem = fileSystem;
    }

    public Task<string> ReadAsync(string path)
    {
        return this.fileSystem.ReadAllTextAsync(path);
    }
}
Use problem details exception handling

ProblemDetailsExceptionHandler converts unhandled exceptions into RFC-style problem details responses.

Register it in Program.cs:

using Superdev.AspNetCore.ExceptionHandling;

builder.Services.AddProblemDetails();
builder.Services.AddExceptionHandler<ProblemDetailsExceptionHandler>();

var app = builder.Build();
app.UseExceptionHandler();

If you also want MVC/ObjectResult responses with status codes >= 400 to be normalized to ProblemDetails, add ProblemDetailsResultFilter:

using Superdev.AspNetCore.ExceptionHandling;

builder.Services.AddControllers(options =>
{
    options.Filters.Add<ProblemDetailsResultFilter>();
});

Design Goals

  • Keep dependencies minimal and explicit.
  • Prefer framework-native ASP.NET Core primitives over large abstraction layers.
  • Move only code that is broadly reusable across multiple projects.
  • Keep application-specific controllers, DTOs, mappings, secrets and business rules outside this package.

Contribution

Contributors welcome! If you find a bug or you want to propose a new feature, feel free to do so by opening a new issue on github.com.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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
1.0.9-pre 40 4/4/2026
1.0.8-pre 34 4/3/2026
1.0.7-pre 46 4/3/2026
1.0.6-pre 44 4/3/2026

1.0
- Initial release.