private void InitializeFakeObjects()
 {
     _clientRepositoryStub   = new Mock <IClientRepository>();
     _managerEventSourceStub = new Mock <IManagerEventSource>();
     _importAction           = new ImportAction(
         _clientRepositoryStub.Object,
         _managerEventSourceStub.Object);
 }
Пример #2
0
        public void AddAction(IImportAction action)
        {
            if (this.actions == null)
            {
                throw new ArgumentNullException("action");
            }

            this.actions.Add(action);
        }
Пример #3
0
        public ManageActions(
            IExportAction exportAction,
            IImportAction importAction)
        {
            if (exportAction == null)
            {
                throw new ArgumentNullException(nameof(exportAction));
            }

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

            _exportAction = exportAction;
            _importAction = importAction;
        }
Пример #4
0
        /// <summary>
        /// Open a design document from a file
        /// </summary>
        /// <param name="filePath">The filepath to open</param>
        /// <param name="background">If true, the opened design will not be added to the set of currently open designs or made active</param>
        /// <returns></returns>
        public ModelDocument OpenDocument(string filePath, bool background = false)
        {
            ModelDocument result = null;

            if (File.Exists(filePath))
            {
                string        extension = Path.GetExtension(filePath);
                IImportAction importer  = Actions.GetImporterFor(extension);
                if (importer != null)
                {
                    importer.FilePath = filePath;
                    Actions.ExecuteAction(importer, null, !background, false);
                    if (importer is IImportDocumentAction)
                    {
                        result = ((IImportDocumentAction)importer).Document;
                    }
                }
            }
            return(result);
        }