You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

fluentassertions2shouldly

Package Overview
Dependencies
Maintainers
0
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

fluentassertions2shouldly

1.0.0-beta.4
nugetNuGet
Version published
Maintainers
0
Created
Source

FluentAssertions2Shouldly

This library was developed using Cursor, an AI-powered code editor.

All code, all tests and all documentation was written by the AI, no code was written by me.

The AI is not perfect, it is like a very newbie developer. It needed a lot of coaching, and it didn't remember what it was told. On the bright side, it never complained, but just tried to do what it was told, and I could do other stuff while it was wading through its own errors, trying to fix them.

A library that provides a FluentAssertions-style syntax while using Shouldly under the hood. This is perfect for:

  • Projects migrating from FluentAssertions to Shouldly
  • Teams who prefer FluentAssertions' syntax but want to use Shouldly's features
  • Maintaining consistent test style across mixed codebases

Requirements

  • .NET 6 or higher (required for global using statements and file-scoped namespaces)

Installation

dotnet add package FluentAssertions2Shouldly

Usage

The library provides a familiar FluentAssertions-style syntax:

// String assertions
string text = "Hello";
text.Should().Be("Hello");
text.Should().StartWith("He");
text.Should().Contain("ell");

// Numeric assertions
int number = 42;
number.Should().Be(42);
number.Should().BeGreaterThan(40);
number.Should().BeInRange(40, 45);

// Collection assertions
var list = new[] { 1, 2, 3 };
list.Should().HaveCount(3);
list.Should().Contain(2);
list.Should().BeInAscendingOrder();

// Exception assertions
Action action = () => throw new Exception();
action.Should().Throw<Exception>();

While using Shouldly under the hood:

// What you write
text.Should().Be("Hello");

// What actually runs
text.ShouldBe("Hello");

Features

Core Assertions

  • String assertions
  • Numeric assertions
  • Boolean assertions
  • Collection assertions
  • Exception assertions
  • DateTime assertions
  • Dictionary assertions

Specialized Assertions

  • File assertions
  • Async/Task assertions
  • Approximate equality assertions
  • Enum assertions
  • Property change assertions
  • Custom assertions

Documentation

Migration

The library makes it easy to migrate from FluentAssertions to Shouldly gradually:

  • Replace FluentAssertions package with FluentAssertions2Shouldly
  • Tests continue to work with the same syntax
  • Optionally migrate to native Shouldly syntax over time

Example:

// Original FluentAssertions code
using FluentAssertions;
value.Should().Be(expected);

// Step 1: Switch to FluentAssertions2Shouldly
using FluentAssertions2Shouldly;
value.Should().Be(expected);

// Step 2 (Optional): Native Shouldly
using Shouldly;
value.ShouldBe(expected);

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

testing

FAQs

Package last updated on 27 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts