示例#1
0
        private async Task RunTestAsync(Func <RepositoryEnq, Task> test = null
                                        , Func <RepositoryEnq, RepositoryEnq, Task> testMulti = null)
        {
            using var factory       = new TestContextFactory(_data);
            await using var context = factory.GetContext();

            RepositoryEnq repo = new RepositoryEnq(context);

            await(test?.Invoke(repo) ?? Task.CompletedTask);
            await(testMulti?.Invoke(repo, new RepositoryEnq(context)) ?? Task.CompletedTask);
        }
示例#2
0
        // Create test data and pass repositories to access it in callback
        private void RunTest(Action <RepositoryEnq> test = null
                             , Action <RepositoryEnq, RepositoryEnq> testMulti = null)
        {
            using var factory = new TestContextFactory(_data);
            using var context = factory.GetContext();

            var repo = new RepositoryEnq(context);

            test?.Invoke(repo);
            testMulti?.Invoke(repo, new RepositoryEnq(context));
        }