Esempio n. 1
0
 public void VerifyContainer()
 {
     AppContainer.BuildContainer(this.commandArguments.Object);
     Assert.IsNotNull(AppContainer.Container);
     Assert.IsNotEmpty(AppContainer.Container.ComponentRegistry.Registrations);
     Assert.IsTrue(AppContainer.Container.IsRegistered <IApp>());
     Assert.IsTrue(AppContainer.Container.IsRegistered <ISessionService>());
     Assert.IsTrue(AppContainer.Container.IsRegistered <ICommandArguments>());
     Assert.IsTrue(AppContainer.Container.IsRegistered <ICommandDispatcher>());
 }
Esempio n. 2
0
        public static IUnityContainer CreateContainer()
        {
            AppContainer.BuildContainer();
            var container = AppContainer.Container;

            // Registers the build steps, this gives us dependency resolution using the container.
            // NB If you need named parameters into the steps you should override specific registrations
            container.RegisterTypes(typeof(TestDependencies).Assembly.GetTypes().Where(t => Attribute.IsDefined(t, typeof(BindingAttribute))), WithMappings.FromMatchingInterface, WithName.Default, WithLifetime.ContainerControlled);

            return(container);
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new <see cref="App"/>
        /// </summary>
        /// <param name="containerBuilder">An optional <see cref="Container"/></param>
        public App(ContainerBuilder containerBuilder = null)
        {
            this.LogAppStart();
            this.Exit += this.OnExit;
            AppDomain.CurrentDomain.UnhandledException += this.CurrentDomainUnhandledException;
            var splashScreenViewModel = new DXSplashScreenViewModel()
            {
                Title = "DEHP-EcosimPro Adapter", Logo = new Uri($"pack://application:,,,/Resources/logo.png")
            };

            SplashScreenManager.Create(() => new SplashScreen(), splashScreenViewModel).ShowOnStartup();
            containerBuilder ??= new ContainerBuilder();
            RegisterTypes(containerBuilder);
            RegisterViewModels(containerBuilder);
            AppContainer.BuildContainer(containerBuilder);
        }