Ejemplo n.º 1
0
        public void ResolveAll()
        {
            Container          dryContainer = new Container();
            DryIocAnyContainer anyContainer = new DryIocAnyContainer(dryContainer);

            dryContainer.Register <ILogger, Logger>(serviceKey: "a");
            dryContainer.Register <ILogger, AlternateLogger>(serviceKey: "b");

            IList <ILogger> loggers = anyContainer.ResolveAll <ILogger>();

            Assert.AreEqual(2, loggers.Count);
            Assert.AreNotEqual(loggers[0], loggers[1]);
        }
Ejemplo n.º 2
0
        public static void SetUp()
        {
            var container = new DryIocAnyContainer();

            container.RegisterSingleton <IDriveService, DriveService>();
            container.RegisterSingleton <IAppThemeService, AppThemeService>();

            if (Utilities.IsRunningAsAppx)
            {
                container.RegisterSingleton <IToastNotificationService, ToastNotificationService>();
            }
            else
            {
                container.RegisterSingleton <IToastNotificationService, StubToastNotificationService>();
            }

            container.RegisterSingleton <IUpdater, Updater>();
            container.RegisterSingleton <IMessageBoxService, MessageBoxService>();
            container.RegisterSingleton <IAppLogger, MainAppLogger>();
            container.RegisterSingleton <IFileService, FileService>();
            container.RegisterSingleton <IPresetImportExport, PresetImportExport>();
            container.RegisterSingleton <IQueueImportExport, QueueImportExport>();
            container.RegisterSingleton <IProcesses, Processes>();
            container.RegisterSingleton <IProcessAutoPause, ProcessAutoPause>();
            container.RegisterSingleton <ISystemOperations, SystemOperations>();
            container.RegisterSingleton <IWindowManager, WindowManager>();

            container.RegisterSingleton <OutputPathService>();
            container.RegisterSingleton <OutputSizeService>();
            container.RegisterSingleton <PresetsService>();
            container.RegisterSingleton <PickersService>();
            container.RegisterSingleton <ProcessingService>();
            container.RegisterSingleton <SubtitlesService>();
            container.RegisterSingleton <StatusService>();
            container.RegisterSingleton <PreviewUpdateService>();
            container.RegisterSingleton <PreviewImageService>();
            container.RegisterSingleton <ClipboardService>();
            container.RegisterSingleton <TrayService>();

            container.RegisterSingleton <EncodingWindowViewModel>();

            container.RegisterTransient <PreviewWindowViewModel>();
            container.RegisterTransient <PickerWindowViewModel>();
            container.RegisterTransient <OptionsDialogViewModel>();
            container.RegisterTransient <LogWindowViewModel>();
            container.RegisterTransient <QueueTitlesWindowViewModel>();
            container.RegisterTransient <EncodeDetailsWindowViewModel>();

            StaticResolver.SetResolver(container);
            Container = container;
        }