Enigmatry.Entry.SmartEnums.VerifyTests
10.5.0
dotnet add package Enigmatry.Entry.SmartEnums.VerifyTests --version 10.5.0
NuGet\Install-Package Enigmatry.Entry.SmartEnums.VerifyTests -Version 10.5.0
<PackageReference Include="Enigmatry.Entry.SmartEnums.VerifyTests" Version="10.5.0" />
<PackageVersion Include="Enigmatry.Entry.SmartEnums.VerifyTests" Version="10.5.0" />
<PackageReference Include="Enigmatry.Entry.SmartEnums.VerifyTests" />
paket add Enigmatry.Entry.SmartEnums.VerifyTests --version 10.5.0
#r "nuget: Enigmatry.Entry.SmartEnums.VerifyTests, 10.5.0"
#:package Enigmatry.Entry.SmartEnums.VerifyTests@10.5.0
#addin nuget:?package=Enigmatry.Entry.SmartEnums.VerifyTests&version=10.5.0
#tool nuget:?package=Enigmatry.Entry.SmartEnums.VerifyTests&version=10.5.0
Smart Enums VerifyTests
A library that provides testing utilities for Smart Enums using the Verify testing approach, allowing for snapshot testing of Smart Enum behaviors and serialization.
Intended Usage
Use this library when you need to write tests for Smart Enum types using the Verify snapshot testing approach. It helps validate that your Smart Enums behave consistently and serialize correctly.
Requirements
This package depends on Verify 33, which checks at build time that the consuming build declares its maintenance fee status. Declare it once in Directory.Build.props, for example as a GitHub sponsor:
<PropertyGroup>
<Verify_GitHubSponsorAccount>your-github-account</Verify_GitHubSponsorAccount>
</PropertyGroup>
Without a declaration the build fails with SC021.
Installation
Add the package to your project:
dotnet add package Enigmatry.Entry.SmartEnums.VerifyTests
Usage Example
using Enigmatry.Entry.SmartEnums;
using Enigmatry.Entry.SmartEnums.VerifyTests;
using System.Reflection;
using Argon;
using NUnit.Framework;
using VerifyNUnit;
namespace YourProject.Tests
{
[TestFixture]
public class ProductCategoryTests
{
private VerifySettings verifySettings;
[SetUp]
public void Setup()
{
// Create and configure VerifySettings for tests
verifySettings = new VerifySettings();
// Register SmartEnum converters for the Argon JSON serializer used by VerifyTests
var converters = new List<JsonConverter>();
converters.EntryAddSmartEnumJsonConverters(new[] { Assembly.GetExecutingAssembly() });
// Add the converters to the serialization pipeline
verifySettings.UseJsonSerializerSettings(settings =>
{
foreach (var converter in converters)
{
settings.Converters.Add(converter);
}
});
}
[Test]
public Task Should_Verify_All_ProductCategories()
{
// Arrange & Act
var allCategories = ProductCategory.List();
// Assert
// The SmartEnumWriteOnlyJsonConverter will serialize each SmartEnum using its Name property
return Verifier.Verify(allCategories, verifySettings);
}
[Test]
public Task Should_Verify_ProductCategory_Properties()
{
// Arrange & Act
var electronics = ProductCategory.Electronics;
// Assert
return Verifier.Verify(electronics, verifySettings);
}
[Test]
public Task Should_Serialize_SmartEnum_With_Custom_Properties()
{
// Arrange
var category = ProductCategory.Electronics;
// Act - Create a test object with the SmartEnum
var testObject = new
{
Category = category,
CategoryName = category.Name,
CategoryId = category.Value,
DisplayName = category.DisplayName,
IsDigital = category.IsDigitalProduct
};
// Assert
// The SmartEnumWriteOnlyJsonConverter will handle proper serialization
return Verifier.Verify(testObject, verifySettings);
}
}
// Example Smart Enum based on typical Enigmatry.Entry.SmartEnums pattern
public class ProductCategory : SmartEnum<ProductCategory>
{
public static readonly ProductCategory Electronics = new(1, nameof(Electronics), "Electronics & Tech", true);
public static readonly ProductCategory Clothing = new(2, nameof(Clothing), "Apparel & Fashion", false);
public static readonly ProductCategory Books = new(3, nameof(Books), "Books & Media", false);
public static readonly ProductCategory DigitalContent = new(4, nameof(DigitalContent), "Digital Downloads", true);
public string DisplayName { get; }
public bool IsDigitalProduct { get; }
private ProductCategory(int id, string name, string displayName, bool isDigitalProduct)
: base(id, name)
{
DisplayName = displayName;
IsDigitalProduct = isDigitalProduct;
}
}
}
| 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. |
-
net10.0
- Ardalis.SmartEnum (>= 8.2.0)
- Enigmatry.Entry.SmartEnums (>= 10.5.0)
- FluentValidation (>= 12.2.0)
- JetBrains.Annotations (>= 2026.2.0)
- MediatR (= 12.4.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.13)
- Serilog (>= 4.4.0)
- Verify (>= 33.3.3)
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 |
|---|---|---|
| 10.5.0 | 53 | 10/15/2026 |
| 10.4.0 | 90 | 10/6/2026 |
| 10.3.1 | 401 | 8/20/2026 |
| 10.3.0 | 135 | 7/21/2026 |
| 10.2.4 | 632 | 7/3/2026 |
| 10.2.3 | 141 | 6/1/2026 |
| 10.2.3-preview.4 | 79 | 6/1/2026 |
| 10.2.2 | 373 | 4/27/2026 |
| 10.2.1-preview.1 | 77 | 4/27/2026 |
| 10.1.0 | 376 | 4/16/2026 |
| 10.0.1 | 121 | 5/19/2026 |
| 10.0.1-preview.2 | 89 | 4/16/2026 |
| 10.0.0 | 133 | 4/2/2026 |
| 9.6.0 | 135 | 3/18/2026 |
| 9.5.0 | 249 | 1/26/2026 |
| 9.4.0 | 393 | 12/22/2025 |
| 9.3.1-preview.3 | 281 | 12/18/2025 |
| 9.3.1-preview.1 | 201 | 11/25/2025 |
| 8.3.1-preview.1 | 180 | 12/24/2025 |
| 8.3.0 | 220 | 12/23/2025 |