Esempio n. 1
0
        public void BuildWithStageComponentProviderTwice(IRunnerBuilder builder, IRunner runner, IStageComponentProvider provider1, IStageComponentProvider provider2, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a stage component provider"
            .x(() => provider1 = _mockProvider.Object);

            "And a second stage component provider"
            .x(() => provider2 = _mockProvider.Object);

            "When building the runner"
            .x(() => e = Record.Exception(() => runner = builder.FindStageRunners(provider1).FindStageRunners(provider2).Build()));

            "Then the build method should succeed"
            .x(() => e.Should().BeNull());

            "And there should be 8 stage runners found in config"
            .x(() =>
            {
                runner.RunState.Should().NotBeNull();
                runner.RunState.Configuration.Should().NotBeNull();
                runner.RunState.Configuration.StageRunners.Should().NotBeNull().And.Subject.Should().HaveCount(8);
            });
        }
Esempio n. 2
0
        public void SetSameArgsTwiceWithSuccess(IRunnerBuilder builder, IDictionary <string, object> args1, IDictionary <string, object> args2, Exception e1, Exception e2)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a set of arguments in a dictionary"
            .x(() => args1 = new Dictionary <string, object>()
            {
                { "arg1", "val1" }, { "arg2", "val2" }
            });

            "And a second set of the same arguments in a dictionary"
            .x(() => args2 = new Dictionary <string, object>()
            {
                { "arg1", "val1" }, { "arg2", "val2" }
            });

            "When setting the first set of arguments"
            .x(() => e1 = Record.Exception(() => builder.SetArgs(args1)));

            "And setting the second set of arguments"
            .x(() => e2 = Record.Exception(() => builder.SetArgs(args2)));

            "Then both set methods should succeed"
            .x(() =>
            {
                e1.Should().BeNull();
                e2.Should().BeNull();
            });
        }
 public override Runner runnerForClass(Class testClass)
 {
   RunnerBuilder[] runnerBuilderArray = new RunnerBuilder[5];
   int index1 = 0;
   IgnoredBuilder ignoredBuilder = this.ignoredBuilder();
   runnerBuilderArray[index1] = (RunnerBuilder) ignoredBuilder;
   int index2 = 1;
   AnnotatedBuilder annotatedBuilder = this.annotatedBuilder();
   runnerBuilderArray[index2] = (RunnerBuilder) annotatedBuilder;
   int index3 = 2;
   RunnerBuilder runnerBuilder = this.suiteMethodBuilder();
   runnerBuilderArray[index3] = runnerBuilder;
   int index4 = 3;
   JUnit3Builder junit3Builder = this.junit3Builder();
   runnerBuilderArray[index4] = (RunnerBuilder) junit3Builder;
   int index5 = 4;
   JUnit4Builder junit4Builder = this.junit4Builder();
   runnerBuilderArray[index5] = (RunnerBuilder) junit4Builder;
   Iterator iterator = Arrays.asList((object[]) runnerBuilderArray).iterator();
   while (iterator.hasNext())
   {
     Runner runner = ((RunnerBuilder) iterator.next()).safeRunnerForClass(testClass);
     if (runner != null)
       return runner;
   }
   return (Runner) null;
 }
 public override Runner getSuite(RunnerBuilder builder, Class[] classes)
 {
   Runner suite = base.getSuite(builder, classes);
   if (this.fClasses)
     return ParallelComputer.parallelize(suite);
   else
     return suite;
 }
 protected internal override Runner getRunner(RunnerBuilder builder, Class testClass)
 {
   Runner runner = base.getRunner(builder, testClass);
   if (this.fMethods)
     return ParallelComputer.parallelize(runner);
   else
     return runner;
 }
Esempio n. 6
0
        public void ConstructWithSuccess(IRunnerBuilder builder, Exception e)
        {
            "Given a runner builder"
            .x(() => builder.Should().BeNull());

            "When constructing the runner builder"
            .x(() => e = Record.Exception(() => builder = new RunnerBuilder()));

            "Then the runner builder constructor should succeed"
            .x(() => e.Should().BeNull());
        }
Esempio n. 7
0
        public void EnableFailFastSucceeds(IRunnerBuilder builder, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "When enabling the fail fast flag"
            .x(() => e = Record.Exception(() => builder.EnableFailFast()));

            "Then no exception occurs"
            .x(() => e.Should().BeNull());
        }
Esempio n. 8
0
        public void EnableFailStageWithAllStagesSucceeds(IRunnerBuilder builder, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "When enabling the fail fast flag for all stages"
            .x(() => e = Record.Exception(() => builder.EnableFailStage(Stages.All)));

            "Then no exception occurs"
            .x(() => e.Should().BeNull());
        }
Esempio n. 9
0
        public void DisableAllStagesSucceeds(IRunnerBuilder builder, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "When disabling all stages"
            .x(() => e = Record.Exception(() => builder.DisableStage(Stages.All)));

            "Then no exception occurs"
            .x(() => e.Should().BeNull());
        }
Esempio n. 10
0
        public void DisableTwoStagesSucceeds(IRunnerBuilder builder, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "When disabling a stage"
            .x(() => e = Record.Exception(() => builder.DisableStage(Stages.Discover)));

            "And disabling a second stage"
            .x(() => e = Record.Exception(() => builder.DisableStage(Stages.Parse)));

            "Then no exception occurs"
            .x(() => e.Should().BeNull());
        }
Esempio n. 11
0
        public void SkipStageRunnerWithSuccess(IRunnerBuilder builder, Predicate <IStageRunner> skipFunc, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a skip function"
            .x(() => skipFunc = r => (r.Stages & Stages.Report) == Stages.Report ? true : false);

            "When skipping stage runner with a deferred delegate"
            .x(() => e = Record.Exception(() => builder.SkipStageRunner(skipFunc)));

            "Then the skip method should succeed"
            .x(() => e.Should().BeNull());
        }
Esempio n. 12
0
        public void FindStageRunnersWithNullProvider(IRunnerBuilder builder, IStageComponentProvider provider, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a null provider"
            .x(() => provider.Should().BeNull());

            "When finding stage runners using a provider"
            .x(() => e = Record.Exception(() => builder.FindStageRunners(provider)));

            "Then the find method should throw an exception"
            .x(() => e.Should().NotBeNull().And.Subject.Should().BeOfType <ArgumentNullException>().Which.ParamName.Should().Be("provider"));
        }
Esempio n. 13
0
        public void FindStageRunnersWithSuccess(IRunnerBuilder builder, IStageComponentProvider provider, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a stage component provider"
            .x(() => provider = _mockProvider.Object);

            "When finding stage runners using a provider"
            .x(() => e = Record.Exception(() => builder.FindStageRunners(provider)));

            "Then the find method should succeed"
            .x(() => e.Should().BeNull());
        }
Esempio n. 14
0
        public void SetModelWithNullModel(IRunnerBuilder builder, Func <IApplicationModel> modelFunc, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a null model function"
            .x(() => modelFunc.Should().BeNull());

            "When setting the model"
            .x(() => e = Record.Exception(() => builder.SetModel(modelFunc)));

            "Then the set method should throw an exception"
            .x(() => e.Should().NotBeNull().And.Subject.Should().BeOfType <ArgumentNullException>().Which.ParamName.Should().Be("modelFunc"));
        }
Esempio n. 15
0
        public void SetStageRunnerPriorityWithSuccess(IRunnerBuilder builder, Func <IStageRunner, int> priorityFunc, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a priority function"
            .x(() => priorityFunc = r => 999);

            "When setting stage runner priority with a deferred delegate"
            .x(() => e = Record.Exception(() => builder.SetStageRunnerPriority(priorityFunc)));

            "Then the set method should succeed"
            .x(() => e.Should().BeNull());
        }
Esempio n. 16
0
        public void SetStageRunnerPriorityWithNullDelegate(IRunnerBuilder builder, Func <IStageRunner, int> priorityFunc, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a null priority function"
            .x(() => priorityFunc.Should().BeNull());

            "When setting stage runner priority with a deferred delegate"
            .x(() => e = Record.Exception(() => builder.SetStageRunnerPriority(priorityFunc)));

            "Then the set method should throw an exception"
            .x(() => e.Should().NotBeNull().And.Subject.Should().BeOfType <ArgumentNullException>().Which.ParamName.Should().Be("priorityFunc"));
        }
Esempio n. 17
0
        public void EnableFailStageWithTwoStagesSucceeds(IRunnerBuilder builder, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "When enabling the fail fast flag for a single stage"
            .x(() => e = Record.Exception(() => builder.EnableFailStage(Stages.Discover)));

            "And enabling the fail fast flag for a second stage"
            .x(() => e = Record.Exception(() => builder.EnableFailStage(Stages.Parse)));

            "Then no exception occurs"
            .x(() => e.Should().BeNull());
        }
Esempio n. 18
0
        public void AddStageRunnerWithSuccess(IRunnerBuilder builder, IStageRunner runner, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a stage runner"
            .x(() => runner = _mockStageRunners.First().Object);

            "When adding a stage runner"
            .x(() => e = Record.Exception(() => builder.AddStageRunner(runner)));

            "Then the add method should succeed"
            .x(() => e.Should().BeNull());
        }
Esempio n. 19
0
        public void AddStageRunnerWithNullRunner(IRunnerBuilder builder, IStageRunner runner, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a null runner"
            .x(() => runner.Should().BeNull());

            "When adding a stage runner"
            .x(() => e = Record.Exception(() => builder.AddStageRunner(runner)));

            "Then the add method should throw an exception"
            .x(() => e.Should().NotBeNull().And.Subject.Should().BeOfType <ArgumentNullException>().Which.ParamName.Should().Be("runner"));
        }
Esempio n. 20
0
        public void SetLoggerWithSuccess(IRunnerBuilder builder, ILogger <Engine.Runner> logger, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a logger"
            .x(() => logger = _mockLogger.Object);

            "When setting the logger"
            .x(() => e = Record.Exception(() => builder.SetLogger(logger)));

            "Then the set method should succeed"
            .x(() => e.Should().BeNull());
        }
Esempio n. 21
0
        public void SkipStageRunnerWithNullDelegate(IRunnerBuilder builder, Predicate <IStageRunner> skipFunc, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a null skip function"
            .x(() => skipFunc.Should().BeNull());

            "When skipping stage runner with a deferred delegate"
            .x(() => e = Record.Exception(() => builder.SkipStageRunner(skipFunc)));

            "Then the skip method should throw an exception"
            .x(() => e.Should().NotBeNull().And.Subject.Should().BeOfType <ArgumentNullException>().Which.ParamName.Should().Be("skipFunc"));
        }
Esempio n. 22
0
        public void SetLoggerWithNullLogger(IRunnerBuilder builder, ILogger <Engine.Runner> logger, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a null logger"
            .x(() => logger.Should().BeNull());

            "When setting the logger"
            .x(() => e = Record.Exception(() => builder.SetLogger(logger)));

            "Then the set method should throw an exception"
            .x(() => e.Should().NotBeNull().And.Subject.Should().BeOfType <ArgumentNullException>().Which.ParamName.Should().Be("logger"));
        }
Esempio n. 23
0
        public void SetModelWithSuccess(IRunnerBuilder builder, Func <IApplicationModel> modelFunc, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a model function"
            .x(() => modelFunc = () => _mockModel.Object);

            "When setting the model"
            .x(() => e = Record.Exception(() => builder.SetModel(modelFunc)));

            "Then the set method should succeed"
            .x(() => e.Should().BeNull());
        }
Esempio n. 24
0
        public void SetArgsWithNullDictionary(IRunnerBuilder builder, IDictionary <string, object> args, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a null arguments dictionary"
            .x(() => args.Should().BeNull());

            "When setting arguments"
            .x(() => e = Record.Exception(() => builder.SetArgs(args)));

            "Then the set method should throw an exception"
            .x(() => e.Should().NotBeNull().And.Subject.Should().BeOfType <ArgumentNullException>().Which.ParamName.Should().Be("args"));
        }
Esempio n. 25
0
        private static void SingleActionRunner(string[] args)
        {
            var runner = new RunnerBuilder()
                         .UseCommandLineArgs(args)
                         .UseConfig("appsettings.json")
                         .UseInstaller <Bootstrapper>()
                         .BuildSingleActionRunner();

            using (runner)
            {
                runner.Execute(args);
            }

            SingleActionHarness.KeepWindowOpenWhenDebugging();
        }
Esempio n. 26
0
        private static void LongRunner(string[] args)
        {
            var runner = new RunnerBuilder()
                         .UseCommandLineArgs(args)
                         .UseConfig("appsettings.json")
                         .UseInstaller <Bootstrapper>()
                         .BuildLongRunner();

            using (runner)
            {
                runner.RunAndWait();
            }

            LongRunningHarness.KeepWindowOpenWhenDebugging();
        }
Esempio n. 27
0
        static void Main(string[] args)
        {
            using (Runner runner = new RunnerBuilder(DevToken).AsIOS(DeviceUDID, DeviceName, BundleId).Build())
            {
                runner.Run(new BasicTest());
                runner.Run(new ExtendedTest(), true);

                /**
                 * Load proxy assembly into memory to allow SDK finding it's classes
                 * This is only required when running the action proxy in Debug mode via IDE
                 * This not not needed when running from TestProject platform
                 */
                Assembly.LoadFrom("AddonProxy.dll");
                runner.Run(new ProxyTest(), true);
            }
        }
Esempio n. 28
0
        public void SetArgsWithSuccess(IRunnerBuilder builder, IDictionary <string, object> args, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a set of arguments in a dictionary"
            .x(() => args = new Dictionary <string, object>()
            {
                { "arg1", "val1" }, { "arg2", "val2" }
            });

            "When setting arguments"
            .x(() => e = Record.Exception(() => builder.SetArgs(args)));

            "Then the set method should succeed"
            .x(() => e.Should().BeNull());
        }
Esempio n. 29
0
        private static void StartStopRunner(string[] args)
        {
            var runner = new RunnerBuilder()
                         .UseCommandLineArgs(args)
                         .UseConfig("appsettings.json")
                         .UseInstaller <Bootstrapper>()
                         .BuildStartStopRunner();

            using (runner)
            {
                runner.Start();

                Console.WriteLine("\r\n\r\nPress <Enter> to stop services...");
                Console.ReadLine();

                runner.Stop();
            }

            StartStopHarness.KeepWindowOpenWhenDebugging();
        }
Esempio n. 30
0
        public void BuildWithModelFunction(IRunnerBuilder builder, IRunner runner, IStageComponentProvider provider, Exception e)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a stage component provider"
            .x(() => provider = _mockProvider.Object);

            "When building the runner"
            .x(() => e = Record.Exception(() => runner = builder.FindStageRunners(provider).SetModel(() => _mockModel.Object).Build()));

            "Then the build method should succeed"
            .x(() => e.Should().BeNull());

            "And the model should have been set by the model function"
            .x(() =>
            {
                runner.RunState.Should().NotBeNull();
                runner.RunState.Configuration.Should().NotBeNull();
                runner.RunState.Model.Should().BeEquivalentTo(_mockModel.Object);
            });
        }
Esempio n. 31
0
        public void AddTwoStageRunnersWithSuccess(IRunnerBuilder builder, IStageRunner runner1, IStageRunner runner2, Exception e1, Exception e2)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a first stage runner"
            .x(() => runner1 = _mockStageRunners.First().Object);

            "And a second stage runner"
            .x(() => runner2 = _mockStageRunners.Last().Object);

            "When adding first stage runner"
            .x(() => e1 = Record.Exception(() => builder.AddStageRunner(runner1)));

            "And adding second stage runner"
            .x(() => e2 = Record.Exception(() => builder.AddStageRunner(runner2)));

            "Then the first add method should succeed"
            .x(() => e1.Should().BeNull());

            "And the second add method should succeed"
            .x(() => e2.Should().BeNull());
        }
Esempio n. 32
0
        public void SetStageRunnerPriorityTwiceWithSuccess(IRunnerBuilder builder, Func <IStageRunner, int> priorityFunc1, Func <IStageRunner, int> priorityFunc2, Exception e1, Exception e2)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a first priority function"
            .x(() => priorityFunc1 = r => (r.Stages & Stages.Discover) == Stages.Discover ? 10 : 0);

            "And a second priority function"
            .x(() => priorityFunc2 = r => (r.Stages & Stages.Parse) == Stages.Parse ? 20 : 0);

            "When setting first stage runner priority with a deferred delegate"
            .x(() => e1 = Record.Exception(() => builder.SetStageRunnerPriority(priorityFunc1)));

            "And setting second stage runner priority with a deferred delegate"
            .x(() => e2 = Record.Exception(() => builder.SetStageRunnerPriority(priorityFunc2)));

            "Then the first set method should succeed"
            .x(() => e1.Should().BeNull());

            "And the second set method should succeed"
            .x(() => e2.Should().BeNull());
        }
Esempio n. 33
0
        public void SkipStageRunnerTwiceWithSuccess(IRunnerBuilder builder, Predicate <IStageRunner> skipFunc1, Predicate <IStageRunner> skipFunc2, Exception e1, Exception e2)
        {
            "Given a runner builder"
            .x(() => builder = new RunnerBuilder());

            "And a first skip function"
            .x(() => skipFunc1 = r => (r.Stages & Stages.Discover) == Stages.Analyze ? true : false);

            "And a second skip function"
            .x(() => skipFunc2 = r => (r.Stages & Stages.Parse) == Stages.Report ? true : false);

            "When skipping first stage runner with a deferred delegate"
            .x(() => e1 = Record.Exception(() => builder.SkipStageRunner(skipFunc1)));

            "And skipping second stage runner with a deferred delegate"
            .x(() => e2 = Record.Exception(() => builder.SkipStageRunner(skipFunc2)));

            "Then the first skip method should succeed"
            .x(() => e1.Should().BeNull());

            "And the second skip method should succeed"
            .x(() => e2.Should().BeNull());
        }
Esempio n. 34
0
 public Suite(RunnerBuilder builder, Class[] classes)
   : this((Class) null, builder.runners((Class) null, classes))
 {
 }
Esempio n. 35
0
 public Suite(Class klass, RunnerBuilder builder)
   : this(builder, klass, Suite.getAnnotatedClasses(klass))
 {
 }
Esempio n. 36
0
 public AnnotatedBuilder(RunnerBuilder suiteBuilder)
 {
   AnnotatedBuilder annotatedBuilder = this;
   this.fSuiteBuilder = suiteBuilder;
 }
Esempio n. 37
0
 public Enclosed(Class klass, RunnerBuilder builder)
   : base(builder, klass, klass.getClasses(Enclosed.__\u003CGetCallerID\u003E()))
 {
 }
Esempio n. 38
0
 protected internal virtual Runner getRunner(RunnerBuilder builder, Class testClass)
 {
   return builder.runnerForClass(testClass);
 }
Esempio n. 39
0
 public virtual Runner getSuite(RunnerBuilder builder, Class[] classes)
 {
   return (Runner) new Suite((RunnerBuilder) new Computer\u00241(this, builder), classes);
 }
Esempio n. 40
0
 protected internal Suite(RunnerBuilder builder, Class klass, Class[] suiteClasses)
   : this(klass, builder.runners(klass, suiteClasses))
 {
 }