示例#1
0
        public virtual void InitTest()
        {
            IocContainerProvider.InitIoc();

            var obj = IocContainerProvider.CurrentContainer.GetInstance <TestClass>();

            Assert.AreNotEqual(1, obj.GetOne());
        }
示例#2
0
        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);
        }
示例#3
0
        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");
        }
示例#4
0
        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();
        }
示例#5
0
        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();
        }
示例#6
0
        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 }
            });
        }
示例#7
0
 public virtual void SetUp()
 {
     IocContainerProvider.InitIoc();
 }
示例#8
0
 static TestBase()
 {
     IocContainerProvider.InitIoc();
 }