/// <inheritdoc /> protected override int RunImpl(string[] args) { if (!ParseArguments(args)) { ShowHelp(); return(1); } if (Arguments.Help) { ShowHelp(); return(0); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); UnhandledErrorPolicy(); var runtimeSetup = new RuntimeSetup { RuntimePath = Path.GetDirectoryName(AssemblyUtils.GetFriendlyAssemblyLocation( typeof(IcarusProgram).Assembly)) }; var runtimeLogger = new RuntimeLogger(); GenericCollectionUtils.ForEach(Arguments.PluginDirectories, runtimeSetup.AddPluginDirectory); using (RuntimeBootstrap.Initialize(runtimeSetup, runtimeLogger)) { // wire up services & components var scanner = new DefaultConventionScanner(RuntimeAccessor.Registry); scanner.Scan("Gallio.Icarus", Assembly.GetExecutingAssembly()); LoadPackages(); var optionsController = RuntimeAccessor.ServiceLocator.Resolve <IOptionsController>(); // create & initialize a test runner whenever the test runner factory is changed optionsController.TestRunnerFactory.PropertyChanged += (s, e) => ConfigureTestRunnerFactory(optionsController.TestRunnerFactory); ConfigureTestRunnerFactory(optionsController.TestRunnerFactory); var runtimeLogController = RuntimeAccessor.ServiceLocator.Resolve <IRuntimeLogController>(); runtimeLogController.SetLogger(runtimeLogger); var applicationController = RuntimeAccessor.ServiceLocator.Resolve <IApplicationController>(); applicationController.Arguments = Arguments; ErrorDialogUnhandledExceptionHandler.RunApplicationWithHandler(new Main(applicationController)); UnloadPackages(); } return(ResultCode.Success); }
public void Process_to_PluginGraph() { var graph = new PluginGraph(); var scanner = new DefaultConventionScanner(); var registry = new Registry(); scanner.Process(typeof(Convention), registry); registry.ShouldBeOfType <IPluginGraphConfiguration>().Configure(graph); Assert.IsFalse(graph.Families.Has(typeof(IServer))); Assert.IsTrue(graph.Families.Has(typeof(IConvention))); PluginFamily family = graph.Families[typeof(IConvention)]; Assert.AreEqual(1, family.Instances.Count()); }
public void Process_to_PluginGraph() { var graph = new PluginGraph(); var scanner = new DefaultConventionScanner(); var registry = new Registry(); scanner.Process(typeof(Convention), registry); registry.As <IPluginGraphConfiguration>().Configure(graph); graph.Families.Has(typeof(IServer)).ShouldBeFalse(); graph.Families.Has(typeof(IConvention)).ShouldBeTrue(); var family = graph.Families[typeof(IConvention)]; family.Instances.Count().ShouldBe(1); }
public void Process_to_PluginGraph() { var graph = new PluginGraph(); var scanner = new DefaultConventionScanner(); var registry = new Registry(); scanner.Process(typeof(Convention), registry); registry.ConfigurePluginGraph(graph); Assert.IsFalse(graph.PluginFamilies.Contains(typeof(IServer))); Assert.IsTrue(graph.PluginFamilies.Contains(typeof(IConvention))); PluginFamily family = graph.FindFamily(typeof(IConvention)); family.Seal(); Assert.AreEqual(1, family.InstanceCount); }
public void should_add_always() { var scanner = new DefaultConventionScanner { Overwrites = OverwriteBehavior.Always }; var services = new ServiceRegistry(); scanner.ShouldAdd(services, typeof(IWidget), typeof(AWidget)).ShouldBeTrue(); services.AddTransient <IWidget, BWidget>(); scanner.ShouldAdd(services, typeof(IWidget), typeof(AWidget)).ShouldBeTrue(); services.AddTransient <IWidget>(x => new AWidget()); scanner.ShouldAdd(services, typeof(IWidget), typeof(AWidget)).ShouldBeTrue(); services.AddTransient <IWidget, AWidget>(); scanner.ShouldAdd(services, typeof(IWidget), typeof(AWidget)).ShouldBeTrue(); }
public void should_add_with_overwrite_if_newer() { var scanner = new DefaultConventionScanner { Overwrites = OverwriteBehavior.NewType }; var services = new ServiceRegistry(); scanner.ShouldAdd(services, typeof(IWidget), typeof(AWidget)).ShouldBeTrue(); services.AddTransient <IWidget, BWidget>(); scanner.ShouldAdd(services, typeof(IWidget), typeof(AWidget)).ShouldBeTrue(); services = new ServiceRegistry(); services.AddTransient <IWidget>(x => new AWidget()); // Can't tell that it's an AWidget, so add scanner.ShouldAdd(services, typeof(IWidget), typeof(AWidget)).ShouldBeTrue(); services = new ServiceRegistry(); services.AddTransient <IWidget, AWidget>(); scanner.ShouldAdd(services, typeof(IWidget), typeof(AWidget)).ShouldBeFalse(); }