Should is used to do an assertion that fails or passes the test.
An example of assertion is comparing two strings in case insensitive manner:
Which throws an exception with this text to fail the test:
Other assertion types can be found in Assertion Reference.
Should can now be configured to continue on failure. This will report the error to Pester, but won't fail the test immediately. Instead, all the Should failures are collected and reported at the end of the test. This allows you to put multiple assertions into one It and still get complete information on failure.
This new Should behavior is opt-in and can be enabled via
Should.ErrorAction = 'Continue' on the configuration object or via
This allows you to check complex objects easily without writing It for each of the properties that you want to test. You can also use
-ErrotAction Stop to force a failure when a pre-condition is not met. In our case if
$user was null, there would be no point in testing the object further and we would fail the test immediately.