Esempio n. 1
0
        /// <summary>
        /// Runs the tests.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        /// <param name="uniqueSpecName">Name of the unique spec.</param>
        /// <param name="resultFormatter">The result formatter.</param>
        /// <returns></returns>
        public async Task<NSpecResultModel> RunTests(string assembly, string uniqueSpecName, IFormatterWithOutput resultFormatter)
        {
            var task = Task.Run(() =>
            {
                var tags = GetTags(assembly, uniqueSpecName);
                var runnerInvocation = new ContextRunnerInvocator(assembly, tags, resultFormatter, false);
                _activeDomain = new NSpecTestDomain(assembly);
                return _activeDomain.Run(runnerInvocation, t => t.Run());
            });

            return await task;
        }
Esempio n. 2
0
        /// <summary>
        /// Loads the assembly.
        /// </summary>
        /// <param name="assembly">The assembly.</param>
        /// <returns></returns>
        public async Task<NSpecResultModel> LoadAssembly(string assembly)
        {
            var task = Task.Run(() =>
            {
                var runnerInvocation = new ContextRunnerInvocator(assembly, string.Empty);
                _activeDomain = new NSpecTestDomain(assembly);
                var result = _activeDomain.Run(runnerInvocation, t => t.BuildContexts()); ;
                _loadedAssemblies.Add(assembly, result);
                return result;
            });

            return await task;
        }