v1.4.0
New Features
Collection Quantifiers
A complete suite of collection quantifier expectations for testing element conditions:
using SharpAssert;
// All items must match
Assert(items.Each(x => x > 0));
Assert(items.Each(x => x.IsEquivalentTo(template)));
// At least one must match
Assert(items.Some(x => x.Matches("error*")));
// No items may match
Assert(items.None(x => x == null));
// Exactly one must match
Assert(items.One(x => x.Id == targetId));
// Count-based quantifiers
Assert(items.Exactly(3, x => x.Score > 90));
Assert(items.AtLeast(2, x => x.IsEquivalentTo(admin)));
Assert(items.AtMost(1, x => x.Matches("*error*")));All quantifiers support both predicate expressions (x => x > 5) and custom expectations (x => x.IsEquivalentTo(expected)).
Lambda-Based Custom Expectations
New Expectation.From() factory eliminates boilerplate when creating custom expectations:
public static Expectation IsEven(this int value) =>
Expectation.From(
() => value % 2 == 0,
() => [$"Expected even number, got {value}"]
);
Assert(4.IsEven());Multiple Assertions with &&
Logical && now evaluates ALL operands and shows all failures - no short-circuit:
Assert(x == 5 && y == 10);
// Shows both failures when both operands are false:
// &&: Both operands were falseReplaces verbose Assert.Multiple() / AssertionScope patterns with native C# syntax.
Full Changelog: v1.3.0...v1.4.0