givenWhenThenUnitTest<T> function

Future<void> givenWhenThenUnitTest<T>(
  1. T harness,
  2. UnitTestHarnessCallback<T> callback
)

This function is intended to wrap your Unit tests so that you can access the UnitTestGiven, UnitTestWhen, and UnitTestWhen to compose the test case. You will want to create some of your own test support code that is specific to your code under test. It should look something like this:

Future<void> Function() harness(UnitTestHarnessCallback<_ExampleUnitTestHarness> callback) {
  return () => givenWhenThenUnitTest(_ExampleUnitTestHarness(), callback);
}

See example_unit_test_support.dart for a complete example

Implementation

Future<void> givenWhenThenUnitTest<T>(
        T harness, UnitTestHarnessCallback<T> callback) =>
    callback(
        UnitTestGiven(harness), UnitTestWhen(harness), UnitTestThen(harness));