Пример #1
0
        public void Run(RunnerInvocation invocation, Action<RunnerInvocation> action, string dll)
        {
            this.dll = dll;

            var setup = new AppDomainSetup();

            setup.ConfigurationFile = Path.GetFullPath(config);

            setup.ApplicationBase = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            domain = AppDomain.CreateDomain("NSpecDomain.Run", null, setup);

            var type = typeof(Wrapper);

            var assemblyName = type.Assembly.GetName().Name;

            var typeName = type.FullName;

            domain.AssemblyResolve += Resolve;

            var wrapper = (Wrapper)domain.CreateInstanceAndUnwrap(assemblyName, typeName);

            wrapper.Execute(invocation, action);

            AppDomain.Unload(domain);
        }
Пример #2
0
        public ContextWrapper Run(string tagOrClassName, RunnerInvocation invocation, Func<RunnerInvocation, ContextWrapper> action, string dll)
        {
            this.dll = dll;

            var setup = new AppDomainSetup();

            setup.ConfigurationFile = Path.GetFullPath(config);

            setup.ApplicationBase = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            domain = AppDomain.CreateDomain("NSpecRunnerDomain.Run", null, setup);

            var type = typeof(Wrapper);

            var assemblyName = type.Assembly.GetName().Name;

            var typeName = type.FullName;

            domain.AssemblyResolve += Resolve;

            var wrapper = (Wrapper)domain.CreateInstanceAndUnwrap(assemblyName, typeName);

            var results = wrapper.Execute(invocation, action);// RunContexts(tagOrClassName);

            AppDomain.Unload(domain);

            return results;
        }
Пример #3
0
 public SessionResults RunAssembly(Assembly assembly)
 {
     var sessionResults = new SessionResults();
     var runner = new RunnerInvocation(assembly.Location, String.Empty, new GilesSessionResultsFormatter(sessionResults), false);
     var runResults = runner.Run();
     return sessionResults;
 }
Пример #4
0
 public void DebugProxySettingsProviderSpecs()
 {
     const string tagOrClassName = "ProxySettingsProviderSpecs";
     var invocation = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, tagOrClassName);
     var contexts = invocation.Run();
     //assert that there aren't any failures
     contexts.Failures().Count().should_be(0);
 }
        public void Setup()
        {
            formatter = new FormatterStub();

            var invocation = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, typeof(liveconsole_sample_spec).Name, formatter, false);

            contexts = invocation.Run();
        }
Пример #6
0
 public void WebConfigurationAdapterSpecsDebugger()
 {
     const string tagOrClassName = "WebConfigurationAdapterSpecs";
     var invocation = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, tagOrClassName);
     var contexts = invocation.Run();
     //assert that there aren't any failures
     contexts.Failures().Count().should_be(0);
 }
Пример #7
0
        static void Main(string[] args)
        {
            var ri = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, "", false);
            ri.Run();
            
            Console.WriteLine("Done.");
            Console.ReadLine();

        }
Пример #8
0
 public SessionResults RunAssembly(Assembly assembly, IEnumerable<string> filters)
 {
     var sessionResults = new SessionResults();
     var tags = string.Empty;
     if (filters.Any())
         tags = filters.Aggregate((working, next) => working + "," + next);
     var runner = new RunnerInvocation(assembly.Location, tags, new GilesSessionResultsFormatter(sessionResults), false);
     runner.Run();
     return sessionResults;
 }
Пример #9
0
    //tests can be run via TDD.net
    public void debug()
    {
        var tagOrClassName = "";

        var invocation = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, tagOrClassName);

        var contexts = invocation.Run();

        contexts.Failures().Count().should_be(0);
    }
Пример #10
0
    public void debug()
    {
        var tagOrClassName = "class_or_tag_you_want_to_debug";

        var invocation = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, tagOrClassName);

        var contexts = invocation.Run();

        //assert that there aren't any failures
        contexts.Failures().Count().should_be(0);
    }
Пример #11
0
    //[Test]
    public void debug()
    {
        var tagOrClassName = "describe_JsonVisualizer";

        var invocation = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, tagOrClassName);

        var contexts = invocation.Run();

        //assert that there aren't any failures
        contexts.Failures().Count().should_be(0);
    }
Пример #12
0
        public void Run()
        {
            var fixtures = FindFixtures();

            if (!fixtures.Any())
                throw new Exception("No fixtures found in the " + Type + " namespace");

            foreach (var d in fixtures)
            {
                var invocation = new RunnerInvocation(Assembly.GetExecutingAssembly().Location, d);
                var contexts = invocation.Run();
                contexts.Failures().Count().should_be(0);
            }
        }
Пример #13
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                ShowUsage();
                return;
            }
            try
            {
                // extract either a class filter or a tags filter (but not both)
                var argsTags = "";

                var failFast = IsFailFast(args);
                var formatterClassName = GetFormatterClassName(args);

                var formatter = FindFormatter(formatterClassName);

                args = RemoveOptionsAndSwitches(args);

                if (args.Length > 1)
                {
                    // see rspec and cucumber for ideas on better ways to handle tags on the command line:
                    // https://github.com/cucumber/cucumber/wiki/tags
                    // https://www.relishapp.com/rspec/rspec-core/v/2-4/docs/command-line/tag-option
                    if (args[1] == "--tag" && args.Length > 2)
                        argsTags = args[2];
                    else
                        argsTags = args[1];
                }

                var specDLL = args[0];

                var invocation = new RunnerInvocation(specDLL, argsTags, formatter, failFast);

                var domain = new NSpecDomain(specDLL + ".config");

                var failures = domain.Run(invocation, i => i.Run().Failures().Count(), specDLL);

                if (failures > 0) Environment.Exit(1);
            }
            catch (Exception e)
            {
                //hopefully this is handled before here, but if not, this is better than crashing the runner
                Console.WriteLine(e);
                Environment.Exit(1);
            }
        }
Пример #14
0
    public void NSpec()
    {
        if (nspecCollection != null)
        {
            foreach (var tagOrClassName in nspecCollection)
            {
                var invocation = new RunnerInvocation(targetLocation, tagOrClassName);

                var contexts = invocation.Run();

                // Uncomment the below line if the test invocation is to be stopped
                // as soon as a failure is detected.

                contexts.Failures().Count().should_be(0);
            }
        }
    }
Пример #15
0
 public int Execute(RunnerInvocation invocation, Func<RunnerInvocation, int> action)
 {
     return action(invocation);
 }
Пример #16
0
 public ContextWrapper Execute(RunnerInvocation invocation, Func<RunnerInvocation, ContextWrapper> action)
 {
     return action(invocation);
 }
Пример #17
0
 public void Execute(RunnerInvocation invocation, Action<RunnerInvocation> action)
 {
     action(invocation);
 }