예제 #1
0
        public void Create_Always_ReturnsImportInfos()
        {
            // Call
            ImportInfo[] importInfos = MapImportInfoFactory.Create().ToArray();

            // Assert
            Assert.AreEqual(1, importInfos.Length);
            Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(MapDataCollectionContext)));
        }
예제 #2
0
파일: GuiCore.cs 프로젝트: Deltares/Riskeer
        /// <summary>
        /// Initializes a new instance of the <see cref="GuiCore"/> class.
        /// </summary>
        /// <param name="mainWindow">The main window.</param>
        /// <param name="projectStore">The project store.</param>
        /// <param name="projectMigrator">The project migrator.</param>
        /// <param name="projectFactory">The project factory.</param>
        /// <param name="fixedSettings">The fixed settings.</param>
        /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception>
        public GuiCore(IMainWindow mainWindow, IStoreProject projectStore, IMigrateProject projectMigrator, IProjectFactory projectFactory, GuiCoreSettings fixedSettings)
        {
            if (mainWindow == null)
            {
                throw new ArgumentNullException(nameof(mainWindow));
            }

            if (projectStore == null)
            {
                throw new ArgumentNullException(nameof(projectStore));
            }

            if (projectMigrator == null)
            {
                throw new ArgumentNullException(nameof(projectMigrator));
            }

            if (projectFactory == null)
            {
                throw new ArgumentNullException(nameof(projectFactory));
            }

            if (fixedSettings == null)
            {
                throw new ArgumentNullException(nameof(fixedSettings));
            }

            ProjectStore  = projectStore;
            FixedSettings = fixedSettings;
            MainWindow    = mainWindow;

            Plugins = new List <PluginBase>();

            viewCommandHandler = new ViewCommandHandler(this, this, this);

            StorageCommands = new StorageCommandHandler(projectStore, projectMigrator, projectFactory,
                                                        this, dialogBasedInquiryHelper, this);

            importCommandHandler = new GuiImportHandler(MainWindow, Plugins.SelectMany(p => p.GetImportInfos())
                                                        .Concat(MapImportInfoFactory.Create()),
                                                        dialogBasedInquiryHelper);
            exportCommandHandler = new GuiExportHandler(MainWindow, Plugins.SelectMany(p => p.GetExportInfos()));
            updateCommandHandler = new GuiUpdateHandler(MainWindow, Plugins.SelectMany(p => p.GetUpdateInfos()), dialogBasedInquiryHelper);

            WindowsApplication.EnableVisualStyles();
            ViewPropertyEditor.ViewCommands = ViewCommands;

            ProjectOpened       += ApplicationProjectOpened;
            BeforeProjectOpened += ApplicationBeforeProjectOpened;
            projectObserver      = new Observer(UpdateProjectData);

            applicationTitle = string.Format(CultureInfo.CurrentCulture, "{0} {1}",
                                             FixedSettings.ApplicationName,
                                             SettingsHelper.Instance.ApplicationVersion);

            SetTitle();
        }
 public void SetUp()
 {
     importInfo = MapImportInfoFactory.Create().Single(i => i.DataType == typeof(MapDataCollectionContext));
 }