test<T extends ApiService> method

Future<void> Function() test<T extends ApiService>([
  1. FutureOr<void> body()?
])

Implementation

Future<void> Function() test<T extends ApiService>(
    [FutureOr<void> Function()? body]) {
  return () async {
    try {
      await initialize();
    } catch (_) {
      fail('TestHost does not initialize.');
    }

    try {
      if (body != null) {
        await runAsService(body);
      }
    } finally {
      try {
        await shutdown();
      } catch (_) {
        fail('TestHost does shutdown gracefully.');
      }
    }
  };
}