示例#1
0
        public IEnumerable <ITestReport> RunTests([NotNull] IReadOnlyList <ITest> tests, [NotNull] TDataSource dataSource, [NotNull] ISystemContext system, [CanBeNull] Action <ITestMetadata, int> onTestRun = null)
        {
            Assert.ArgumentNotNull(tests, nameof(tests));
            Assert.ArgumentNotNull(dataSource, nameof(dataSource));

            var process = new TestProcessingContext();
            var data    = CreateResoureContext(dataSource, system);

            foreach (var testReport in RunTests(tests, data, process, onTestRun))
            {
                yield return(testReport);
            }
        }
示例#2
0
        public IEnumerable <ITestReport> RunTests([NotNull] IReadOnlyList <ITest> tests, [NotNull] TResource data, [NotNull] TestProcessingContext process, [CanBeNull] Action <ITestMetadata, int> onTestRun = null)
        {
            Assert.ArgumentNotNull(tests, nameof(tests));
            Assert.ArgumentNotNull(data, nameof(data));
            Assert.ArgumentNotNull(process, nameof(process));

            for (var i = 0; i < tests.Count; i++)
            {
                var test = tests[i];

                onTestRun?.Invoke(test, i);

                // run test
                yield return(RunTest(test, data, process));

                // reset context instead of creating new one
                process.Reset();
            }
        }