fluent_assertions 0.2.0

Dart native js
Flutter Android iOS web

Fluent Assertions library written in Dart.

The Fluent Assertions library written in Dart.

It uses Dart's Extension Functions to provide a fluent wrapper around test assertions.

Usage #

Basic Assertions

These assertions are available for all objects.

Equality
'Hello'.shouldBeEqualTo('Hello');
'Hello'.shouldNotBeEqualTo('Word');
Reference equality
final me = Person(name: 'Karol');
final someoneElse = Person(name: 'Karol');
me.shouldBe(me);
me.shouldNotBe(someoneElse);
Subtypes
const num numberOfGirlsIAttract = 0;
numberOfGirlsIAttract.shouldBeInstanceOf<int>();
numberOfGirlsIAttract.shouldNotBeInstanceOf<double>();
Nullability
const hello = 'Hello';
hello.shouldNotBeNull();
const hello = null;
hello.shouldBeNull();
Booleans
const hasChildren = true;
hasChildren.shouldBeTrue();
hasChildren.shouldNotBeFalse();
const hasChildren = false;
hasChildren.shouldBeFalse();
hasChildren.shouldNotBeTrue();

Numerical Assertions

2.shouldBeGreaterOrEqualTo(2);
2.shouldBeGreaterThan(1);
2.shouldBeLessOrEqualTo(2);
1.shouldBeLessThan(2);
1.shouldBePositive();
1.shouldNotBeNegative();
(-1).shouldBeNegative();
(-1).shouldNotBePositive();
0.shouldBeZero();
1.shouldNotBeZero();
0.999.shouldBeNear(1, delta: 0.01);
0.shouldNotBeInRange(lowerBound: 1, upperBound: 6);
1.shouldBeInRange(lowerBound: 1, upperBound: 6);

CharSequence Assertions

Collection Assertions

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Author #

1
likes
100
pub points
26%
popularity

Fluent Assertions library written in Dart.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

karol.lisiewicz@gmail.com

License

MIT (LICENSE)

Dependencies

test

More

Packages that depend on fluent_assertions