PosInformatique.Foundations.People.FluentAssertions 1.0.0-alpha.6

Prefix Reserved
This is a prerelease version of PosInformatique.Foundations.People.FluentAssertions.
dotnet add package PosInformatique.Foundations.People.FluentAssertions --version 1.0.0-alpha.6
                    
NuGet\Install-Package PosInformatique.Foundations.People.FluentAssertions -Version 1.0.0-alpha.6
                    
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="PosInformatique.Foundations.People.FluentAssertions" Version="1.0.0-alpha.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PosInformatique.Foundations.People.FluentAssertions" Version="1.0.0-alpha.6" />
                    
Directory.Packages.props
<PackageReference Include="PosInformatique.Foundations.People.FluentAssertions" />
                    
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 PosInformatique.Foundations.People.FluentAssertions --version 1.0.0-alpha.6
                    
#r "nuget: PosInformatique.Foundations.People.FluentAssertions, 1.0.0-alpha.6"
                    
#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 PosInformatique.Foundations.People.FluentAssertions@1.0.0-alpha.6
                    
#: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=PosInformatique.Foundations.People.FluentAssertions&version=1.0.0-alpha.6&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=PosInformatique.Foundations.People.FluentAssertions&version=1.0.0-alpha.6&prerelease
                    
Install as a Cake Tool

PosInformatique.Foundations.People.FluentAssertions

NuGet version NuGet downloads

Introduction

Assertion extensions for FirstName and LastName value objects from PosInformatique.Foundations.People using FluentAssertions.

This package resolves the ambiguity that occurs when using FluentAssertions directly on these value objects and provides a simple, idiomatic assertion API where Be(string) compares the literal content (case-sensitive for FirstName, uppercased for LastName as per normalization).

Why this package?

  • FirstName and LastName implement both IEnumerable<char> and IComparable<T>.
  • Calling Should() from FluentAssertions on such types leads to a compile-time ambiguity:
    • The call is ambiguous between the following methods or properties: AssertionExtensions.Should<T>(IEnumerable<T>) and AssertionExtensions.Should<T>(IComparable<T>)
  • This package introduces dedicated Should() extensions that return specialized assertions to avoid that ambiguity.

Install

You can install the package from NuGet:

dotnet add package PosInformatique.Foundations.People.FluentAssertions

Features

  • Should() extension for FirstName returning FirstNameAssertions.
  • Should() extension for LastName returning LastNameAssertions.
  • Be(string) compares the value object to a string using the normalized literal content:
    • For FirstName, comparison is case-sensitive against the normalized first name (e.g., "Jean-Pierre").
    • For LastName, comparison is case-sensitive against the normalized last name (e.g., "DUPONT").

Examples

Basic usage with FirstName:

using FluentAssertions;
using PosInformatique.Foundations.People;

var firstName = FirstName.Create("jean-pierre");

// Passes: "jean-pierre" is normalized to "Jean-Pierre"
firstName.Should().Be("Jean-Pierre");

// Fails (case-sensitive): expected "JEAN-PIERRE"
firstName.Should().Be("JEAN-PIERRE");

Basic usage with LastName:

using FluentAssertions;
using PosInformatique.Foundations.People;

var lastName = LastName.Create("dupont");

// Passes: normalization uppercases to "DUPONT"
lastName.Should().Be("DUPONT");

// Fails (case-sensitive): expected "Dupont"
lastName.Should().Be("Dupont");

Using with your domain model:

using FluentAssertions;
using PosInformatique.Foundations.People;

public sealed class User
{
    public User(string firstName, string lastName)
    {
        FirstName = FirstName.Create(firstName);
        LastName = LastName.Create(lastName);
    }

    public FirstName FirstName { get; }
    public LastName LastName { get; }
}

var user = new User("alice", "martin");
user.FirstName.Should().Be("Alice");
user.LastName.Should().Be("MARTIN");
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 was computed.  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.0-alpha.6 58 10/10/2025

1.0.0
 - Initial release with the support FluentAssertions to assert the FirstName and LastName value objects.