VOOZH about

URL: https://www.nuget.org/packages/Enigmatry.Entry.AspNetCore.Tests.Utilities/

⇱ NuGet Gallery | Enigmatry.Entry.AspNetCore.Tests.Utilities 10.2.3




👁 Image
Enigmatry.Entry.AspNetCore.Tests.Utilities 10.2.3

dotnet add package Enigmatry.Entry.AspNetCore.Tests.Utilities --version 10.2.3
 
 
NuGet\Install-Package Enigmatry.Entry.AspNetCore.Tests.Utilities -Version 10.2.3
 
 
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="Enigmatry.Entry.AspNetCore.Tests.Utilities" Version="10.2.3" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Enigmatry.Entry.AspNetCore.Tests.Utilities" Version="10.2.3" />
 
Directory.Packages.props
<PackageReference Include="Enigmatry.Entry.AspNetCore.Tests.Utilities" />
 
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 Enigmatry.Entry.AspNetCore.Tests.Utilities --version 10.2.3
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Enigmatry.Entry.AspNetCore.Tests.Utilities, 10.2.3"
 
 
#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 Enigmatry.Entry.AspNetCore.Tests.Utilities@10.2.3
 
 
#: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=Enigmatry.Entry.AspNetCore.Tests.Utilities&version=10.2.3
 
Install as a Cake Addin
#tool nuget:?package=Enigmatry.Entry.AspNetCore.Tests.Utilities&version=10.2.3
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

ASP.NET Core Tests Utilities

A library that provides testing utilities and helpers for ASP.NET Core applications, making it easier to write clean, effective tests for web applications and APIs.

Intended Usage

Use this library when you need to write tests for ASP.NET Core applications. It provides utilities for mocking HTTP contexts, working with controllers, testing middleware, and more.

Installation

Add the package to your project:

dotnet add package Enigmatry.Entry.AspNetCore.Tests.Utilities

Usage Example

Testing exception handling in a controller:

using Enigmatry.Entry.AspNetCore.Tests;
using Enigmatry.Entry.AspNetCore.Filters;
using Microsoft.AspNetCore.Mvc;
using NUnit.Framework;
using FakeItEasy;
using FluentValidation;

[TestFixture]
public class ExceptionHandlingTests
{ [Test]
 public void HandleExceptionsFilter_ShouldReturnBadRequest_WhenValidationExceptionOccurs()
 {
 // Arrange
 var exceptionContext = ExceptionContextBuilder.Create()
 .WithValidationException()
 .WithJsonRequest()
 .Build();
 var filter = new HandleExceptionsFilter();
 
 // Act
 filter.OnException(exceptionContext);
 
 // Assert var result = exceptionContext.Result as BadRequestObjectResult;
 Assert.That(result, Is.Not.Null);
 Assert.That(result.Value, Is.Not.Null);
 }
}

Testing HTTP contexts:

using Enigmatry.Entry.AspNetCore.Tests;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Diagnostics;
using NUnit.Framework;

[TestFixture]
public class HttpContextTests
{ [Test]
 public void HttpContextBuilder_ShouldCreateValidContext_WithException()
 {
 // Arrange
 var exception = new InvalidOperationException("Test exception");
 
 // Act
 var context = HttpContextBuilder.Create()
 .With(exception)
 .Build();
 // Assert
 var feature = context.Features.Get<IExceptionHandlerPathFeature>();
 Assert.That(feature, Is.Not.Null);
 Assert.That(feature.Error.Message, Is.EqualTo("Test exception"));
 Assert.That(context.Request.Headers["Accept"], Is.EqualTo("application/json"));
 }
}

Service Scope Example

using Enigmatry.Entry.AspNetCore.Tests.Utilities;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;

[TestFixture]
public class ServiceTests
{ [Test]
 public void ServiceScope_ResolvesService_Successfully()
 {
 // Arrange
 var services = new ServiceCollection();
 services.AddScoped<IMyService, MyService>();
 var provider = services.BuildServiceProvider();
 
 // Act
 using var scope = provider.CreateScope();
 var service = scope.Resolve<IMyService>();
 // Assert
 Assert.That(service, Is.Not.Null);
 Assert.That(service, Is.TypeOf<MyService>());
 }
}

Database Utilities Example

using Enigmatry.Entry.AspNetCore.Tests.Utilities.Database;
using Microsoft.Data.SqlClient;
using NUnit.Framework;

[TestFixture]
public class DatabaseTests
{ [Test]
 public void DatabaseHelpers_ProvidesDropAllSql()
 {
 // Arrange
 var connectionString = "Server=(localdb)\\MSSQLLocalDB;Database=TestDb;Integrated Security=true";
 
 // Act & Assert
 Assert.NotNull(DatabaseHelpers.DropAllSql);
 
 // Example of how you might use it in a real test
 // using var connection = new SqlConnection(connectionString);
 // connection.Open();
 // var command = new SqlCommand(DatabaseHelpers.DropAllSql, connection);
 // command.ExecuteNonQuery();
 }
}
Product Versions Compatible and additional computed target framework versions.
.NET net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows 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 (2)

Showing the top 2 NuGet packages that depend on Enigmatry.Entry.AspNetCore.Tests.Utilities:

Package Downloads
Enigmatry.Entry.AspNetCore.Tests.SystemTextJson

Building Block for writing tests in an Entry AspNetCore based project with SystemText Json

Enigmatry.Entry.AspNetCore.Tests.NewtonsoftJson

Building Block for writing tests in an Entry AspNetCore based project with Newtonsoft Json

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.2.3 155 6/1/2026
10.2.3-preview.4 60 6/1/2026
10.2.2 372 4/27/2026
10.2.1-preview.1 57 4/27/2026
10.1.0 291 4/16/2026
10.0.1 188 5/19/2026
10.0.1-preview.2 66 4/16/2026
10.0.0 142 4/2/2026
9.6.0 544 3/18/2026
9.5.0 1,256 1/26/2026
9.4.0 1,792 12/22/2025
9.3.1-preview.3 271 12/18/2025
9.3.1-preview.1 508 11/25/2025
9.3.0 1,210 11/10/2025
9.2.0 1,553 9/24/2025
9.1.1-preview.5 243 8/8/2025
9.1.1-preview.4 145 6/27/2025
8.3.1-preview.1 214 12/24/2025
8.3.0 1,199 12/23/2025
8.2.0 461 9/24/2025
Loading failed