SatisfyAllConditions

var mrBurns = new Person { Name = null };
mrBurns.ShouldSatisfyAllConditions(
                    () => mrBurns.Name.ShouldNotBeNullOrEmpty(),
                    () => mrBurns.Name.ShouldBe("Mr.Burns"));

snippet source | anchor

Exception

mrBurns
    should satisfy all the conditions specified, but does not.
The following errors were found ...
--------------- Error 1 ---------------
    mrBurns.Name (null)
        should not be null or empty

--------------- Error 2 ---------------
    mrBurns.Name
        should be
    "Mr.Burns"
        but was
    null

-----------------------------------------

Generic

var mrBurns = new Person { Name = null };
mrBurns.ShouldSatisfyAllConditions(
                    p => p.Name.ShouldNotBeNullOrEmpty(),
                    p => p.Name.ShouldBe("Mr.Burns"));

snippet source | anchor

Exception

mrBurns
    should satisfy all the conditions specified, but does not.
The following errors were found ...
--------------- Error 1 ---------------
    p => p.Name (null)
        should not be null or empty

--------------- Error 2 ---------------
    p => p.Name
        should be
    "Mr.Burns"
        but was
    null

-----------------------------------------

Last updated