public virtual void InitTest() { IocContainerProvider.InitIoc(); var obj = IocContainerProvider.CurrentContainer.GetInstance <TestClass>(); Assert.AreNotEqual(1, obj.GetOne()); }
public void SetUp() { IocContainerProvider.InitIoc(); var modelElementStorage = new Moq.Mock <IModelElementStorage>(); modelElementStorage.Setup(x => x.GetModelElementTree(It.IsAny <string>())) .Returns((string x) => AllClassDescriptions.FirstOrDefault(y => y.DisplayText == x)); this.dynamicApiWarder = new DynamicApiWarder(modelElementStorage.Object); }
public virtual void Start() { this.logger.Info("IoC initializing...."); IocContainerProvider.InitIoc(); IocContainerProvider.CurrentContainer.Verify(); this.logger.Info("IoC initialized."); this.logger.Info("Service starting"); var serviceUrl = ConfigurationManager.AppSettings["serviceUrl"]; this.owinWeb = WebApp.Start <Startup>(serviceUrl); this.logger.Info("Service started"); }
public static IServiceProvider AddDependencies(this IServiceCollection services) { var containerBuilder = new ContainerBuilder(); RegisterDependencies(containerBuilder); services.AddMemoryCache(); containerBuilder.Populate(services); var container = containerBuilder.Build(); IocContainerProvider.Register(container); return(new AutofacServiceProvider(container)); }
public static void Main(string[] args) { var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile("appsettings.json"); var cfg = builder.Build(); LoadExtensions(); Logger.Info("IoC initializing...."); try { IocContainerProvider.InitIoc(cfg); IocContainerProvider.CurrentContainer.Verify(); } catch (ReflectionTypeLoadException ex) { if (ex.LoaderExceptions != null) { foreach (var loaderException in ex.LoaderExceptions) { Logger.Error(loaderException); } } throw; } Logger.Info("IoC initialized."); InitExtensions(cfg); var agentManager = IocContainerProvider.CurrentContainer.GetInstance <IAgentManager>(); agentManager.StartManager(); var wait = new ManualResetEvent(false); Console.CancelKeyPress += (sender, eventArgs) => wait.Set(); Logger.Info("The service is now running, press Control+C to exit."); wait.WaitOne(); }
public override void Start() { this.logger.Info("IoC initializing...."); IocContainerProvider.InitIoc(); IocContainerProvider.CurrentContainer.Verify(); this.logger.Info("IoC initialized."); PlatformBusFactory.RedButton.Invoke(); this.logger.Info("Service started"); this.platformBus = IocContainerProvider.CurrentContainer.GetInstance <IPlatformBus>(); this.dataProvider = IocContainerProvider.CurrentContainer.GetInstance <AttemptDataProvider>(); //HangfireBootstrapper.Instance.Start(); //IocContainerProvider.CurrentContainer.GetInstance<ISendRetryStrategy>().RetryMessagePublish(); //IocContainerProvider.CurrentContainer.GetInstance<IConsumeRetryStrategy>().RetryConsumerMessage(); TestOne(); }
public virtual void Start() { if (Directory.Exists(DynamicLibPath)) { foreach (var dll in Directory.GetFiles(DynamicLibPath, "*.dll")) { var ass = Assembly.LoadFrom(dll); this.logger.Info($"LOADING EXTENSION {ass}"); if (ass.Location != null) { AppDomain.CurrentDomain.Load(AssemblyName.GetAssemblyName(ass.Location)); } else { this.logger.Error($"ERROR LOADING EXTENSION {ass}: Assembly.Location property is null"); } } } else { this.logger.Warn("NO EXTENSIONS FOUND"); } this.logger.Info("IoC initializing...."); IocContainerProvider.InitIoc(); IocContainerProvider.CurrentContainer.Verify(); this.logger.Info("IoC initialized."); IocContainerProvider.CurrentContainer.GetInstance <ManagerInitializer>().StartManager(); PlatformBusFactory.RedButton.Invoke(); this.logger.Info("Service started"); var serviceUrl = ConfigurationManager.AppSettings["serviceUrl"]; this.owinWeb = WebApp.Start(new StartOptions() { AppStartup = typeof(OwinStartup).AssemblyQualifiedName, Urls = { serviceUrl } }); }
public virtual void SetUp() { IocContainerProvider.InitIoc(); }
static TestBase() { IocContainerProvider.InitIoc(); }