![]() |
VOOZH | about |
dotnet add package Enigmatry.Entry.SmartEnums.VerifyTests --version 10.2.3
NuGet\Install-Package Enigmatry.Entry.SmartEnums.VerifyTests -Version 10.2.3
<PackageReference Include="Enigmatry.Entry.SmartEnums.VerifyTests" Version="10.2.3" />
<PackageVersion Include="Enigmatry.Entry.SmartEnums.VerifyTests" Version="10.2.3" />Directory.Packages.props
<PackageReference Include="Enigmatry.Entry.SmartEnums.VerifyTests" />Project file
paket add Enigmatry.Entry.SmartEnums.VerifyTests --version 10.2.3
#r "nuget: Enigmatry.Entry.SmartEnums.VerifyTests, 10.2.3"
#:package Enigmatry.Entry.SmartEnums.VerifyTests@10.2.3
#addin nuget:?package=Enigmatry.Entry.SmartEnums.VerifyTests&version=10.2.3Install as a Cake Addin
#tool nuget:?package=Enigmatry.Entry.SmartEnums.VerifyTests&version=10.2.3Install as a Cake Tool
A library that provides testing utilities for Smart Enums using the Verify testing approach, allowing for snapshot testing of Smart Enum behaviors and serialization.
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.
Add the package to your project:
dotnet add package Enigmatry.Entry.SmartEnums.VerifyTests
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 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. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.2.3 | 103 | 6/1/2026 |
| 10.2.3-preview.4 | 50 | 6/1/2026 |
| 10.2.2 | 207 | 4/27/2026 |
| 10.2.1-preview.1 | 58 | 4/27/2026 |
| 10.1.0 | 223 | 4/16/2026 |
| 10.0.1 | 95 | 5/19/2026 |
| 10.0.1-preview.2 | 68 | 4/16/2026 |
| 10.0.0 | 112 | 4/2/2026 |
| 9.6.0 | 117 | 3/18/2026 |
| 9.5.0 | 230 | 1/26/2026 |
| 9.4.0 | 375 | 12/22/2025 |
| 9.3.1-preview.3 | 261 | 12/18/2025 |
| 9.3.1-preview.1 | 181 | 11/25/2025 |
| 9.3.0 | 862 | 11/10/2025 |
| 9.2.0 | 235 | 9/24/2025 |
| 9.1.1-preview.5 | 234 | 8/8/2025 |
| 9.1.1-preview.4 | 154 | 6/27/2025 |
| 8.3.1-preview.1 | 160 | 12/24/2025 |
| 8.3.0 | 200 | 12/23/2025 |
| 8.2.0 | 211 | 9/24/2025 |