private void InitializeFakeObjects()
 {
     _getClientsActionStub   = new Mock <IGetClientsAction>();
     _managerEventSourceStub = new Mock <IManagerEventSource>();
     _exportAction           = new ExportAction(
         _getClientsActionStub.Object,
         _managerEventSourceStub.Object);
 }
Esempio n. 2
0
        /// <summary>
        /// Save a model document to a file
        /// </summary>
        /// <param name="filePath">The filepath to save to</param>
        /// <param name="document">The document to be saved</param>
        /// <returns>True if export command ran successfully</returns>
        public bool SaveDocument(FilePath filePath, ModelDocument document)
        {
            string        extension = Path.GetExtension(filePath);
            IExportAction exporter  = Actions.GetExporterFor(extension);

            if (exporter != null)
            {
                exporter.FilePath = filePath;
                exporter.Document = document;
                Actions.ExecuteAction(exporter, null, true, false);
                return(true);
            }
            PrintLine("Error: No exporter loaded for extension '." + extension + "'.  File could not be written.");
            return(false);
        }
Esempio n. 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;
        }
Esempio n. 4
0
 public ExportViewModel(IExportAction export)
     : base(export)
 {
     _export = export;
     _openInExplorerCommand = new DelegateCommand(OpenInExplorer, CanOpenInExplorer);
 }