Ejemplo n.º 1
0
        public string DoWorkImpl(ExportCommand command, string finalCbxPath)
        {
            string cbxFile   = FileUtil.GetPlatformPath(finalCbxPath);
            int    processId = CommonUtil.Process.ProcessUtil.GetCurrentProcessId();

            List <string> flagGroups = new List <string>();

            flagGroups.Add("\"" + cbxFile + "\"");
            flagGroups.Add("parentProcessId:" + processId);
            flagGroups.Add("showLibStack:" + (command.DirectRunShowLibStack ? "yes" : "no"));
            flagGroups.Add("showOutputPrefixes:" + (command.UseOutputPrefixes ? "yes" : "no"));

            int userCmdLineArgCount = command.DirectRunArgs.Length;

            if (userCmdLineArgCount > 0)
            {
                flagGroups.Add("runtimeargs:" + userCmdLineArgCount + ":" + string.Join(",", command.DirectRunArgs.Select(s => Base64.ToBase64(s))));
            }
            else
            {
                flagGroups.Add("runtimeargs:0");
            }

            string flags = string.Join(" ", flagGroups);

            return(flags);
        }
Ejemplo n.º 2
0
        public void Init(ExportCommand c, Func <AppOptions> option)
        {
            this.command = c;
            this.option  = option;

            var m    = Lookup[c.ProviderType];
            var sims = m.SupportedSims.Select(s => SimDisplayName[s.Type])
                       .Concat(List(Custom)).ToArray();

            CheckBox.Text    = m.DisplayName;
            CheckBox.Checked = c.Enabled;

            SimComboBox.SelectedIndexChanged += (s, e) =>
            {
                // Only allow selecting custom path.
                BrowseBtnEnabled = SimComboBox.SelectedIndex == SimComboBox.Items.Count - 1;

                var path      = GetDirectoryPath();
                var pathValid = path != null;
                PathTextBox.Text = pathValid ? path : "";
            };

            SimComboBox.SetItems(sims);
            if (sims.Length > 0)
            {
                SimComboBox.SelectedIndex = 0;
            }
            SimComboBox.Text = c.DefaultSimulator == null ? Custom :
                               SimDisplayName[c.DefaultSimulator.Value];

            FileFolderBrowse.LinkFolderBrowse(BrowseBtn, PathTextBox);
        }
Ejemplo n.º 3
0
            public AppOptions Deserialize(XElement item)
            {
                var d = Default;

                Action[] actions =
                {
                    () => d.NavDataLocation          = item.GetString("DatabasePath"),
                    () => d.PromptBeforeExit         = item.GetBool("PromptBeforeExit"),
                    () => d.AutoDLTracks             = item.GetBool("AutoDLTracks"),
                    () => d.AutoDLWind               = item.GetBool("AutoDLWind"),
                    () => d.EnableWindOptimizedRoute =
                        item.GetBool("WindOptimizedRoute"),
                    () => d.HideDctInRoute  = item.GetBool("HideDctInRoute"),
                    () => d.ShowTrackIdOnly = item.GetBool("ShowTrackIdOnly"),
                    () => d.AutoUpdate      = item.GetBool("AutoUpdate"),
                    () => d.ExportCommands  =
                        item.Element("ExportOptions")
                        .Elements("KeyValuePair")
                        .ToDictionary(
                            e => e.GetString("Key"),
                            e => ExportCommand.Deserialize(e.Element("Value")))
                };

                foreach (var a in actions)
                {
                    IgnoreException(a);
                }

                return(d);
            }
Ejemplo n.º 4
0
 private void OnExportClick(CommandBarButton Ctrl, ref bool CancelDefault)
 {
     using (var command = new ExportCommand(base.IDE))
     {
         command.Execute();
     }
 }
Ejemplo n.º 5
0
        public void MouseClicked(object sender, MouseButtonEventArgs e)
        {
            System.Windows.Controls.Image image = (System.Windows.Controls.Image)sender;

            System.Windows.Point point = e.GetPosition(image);

            double xRatio = point.X / image.ActualWidth;
            double yRatio = point.Y / image.ActualHeight;

            AddUndoAction(SelectedWhiskerPoint.Clone());

            SelectedWhiskerPoint.XRatio = xRatio;
            SelectedWhiskerPoint.YRatio = yRatio;

            SelectedWhiskerPoint.CanvasWidth  = image.ActualWidth;
            SelectedWhiskerPoint.CanvasHeight = image.ActualHeight;

            NotifyPropertyChanged("Whiskers");
            ExportCommand.RaiseCanExecuteChangedNotification();

            if (AutoNextPoint)
            {
                IncreaseWhiskerCounter();
            }
        }
Ejemplo n.º 6
0
        public void SerializationTest()
        {
            var command1 = new ExportCommand(ProviderType.Pmdg, @"C:\1", true);
            var command2 = new ExportCommand(ProviderType.Fsx, @"D:\1", false);

            var cmds = new Dictionary <string, ExportCommand>()
            {
                ["PmdgNgx"] = command1,
                ["P3D"]     = command2
            };

            var option = new AppOptions(
                "C:\\123", true, true, false, false, true, false, true, cmds);

            var serializer   = new AppOptions.Serializer();
            var elem         = serializer.Serialize(option, "options");
            var deserialized = serializer.Deserialize(elem);

            var o = option;
            var d = deserialized;

            Assert.AreEqual(o.NavDataLocation, d.NavDataLocation);
            Assert.AreEqual(o.PromptBeforeExit, d.PromptBeforeExit);
            Assert.AreEqual(o.AutoDLTracks, d.AutoDLTracks);
            Assert.AreEqual(o.AutoDLWind, d.AutoDLWind);
            Assert.AreEqual(
                o.EnableWindOptimizedRoute, d.EnableWindOptimizedRoute);
            Assert.AreEqual(o.HideDctInRoute, d.HideDctInRoute);
            Assert.AreEqual(o.ShowTrackIdOnly, d.ShowTrackIdOnly);
            Assert.AreEqual(o.AutoUpdate, d.AutoUpdate);
            Assert.AreEqual(cmds.Count, d.ExportCommands.Count);
            Assert.IsTrue(d.ExportCommands["PmdgNgx"].Equals(command1));
            Assert.IsTrue(d.ExportCommands["P3D"].Equals(command2));
        }
Ejemplo n.º 7
0
        /// <summary>
        ///     Created a new instance of <see cref="MainWindowViewModel" />
        /// </summary>
        internal MainWindowViewModel()
        {
            AddFilesCommand = new AddFilesCommand(this);
            ExtractCommand  = new ExtractCommand(this);
            ExportCommand   = new ExportCommand(this);
            FilterCommand   = new FilterCommand(this);
            PopulateCategoryFiltersCommand = new PopulateCategoryFiltersCommand(this);

            Files               = new List <string>();
            ExtractedData       = new ObservableCollection <INode>();
            ExtractedDataShadow = new List <INode>();
            NodeTypeFilters     = new ObservableCollection <INodeTypeFilterViewModel>();
            CategoryFilters     = new ObservableCollection <ICategoryFilterViewModel>();
            ExtractSuits        = true;
            _includeIgnores     = true;

            foreach (
                var filter in
                Enum.GetValues(typeof(NodeTypes))
                .Cast <NodeTypes>()
                .Select(nodeType => new NodeTypeFilterViewModel(nodeType)))
            {
                NodeTypeFilters.Add(filter);
                filter.PropertyChanged += delegate
                {
                    FilterCommand.Execute(null);
                    PopulateCategoryFiltersCommand.Execute(null);
                };
            }
        }
Ejemplo n.º 8
0
 void HandleLoadedProjectChanged(object sender, PropertyChangedEventArgs e)
 {
     ExportCommand?.EmitCanExecuteChanged();
     SaveCommand?.EmitCanExecuteChanged();
     OpenCommand?.EmitCanExecuteChanged();
     DeleteCommand?.EmitCanExecuteChanged();
 }
Ejemplo n.º 9
0
        public ChartCommand(ISharedViewState sharedViewState, ExportCommand exportCommand,
                            TypeOfChartCommand typeOfChartCommand,
                            ColorsCommand colorsCommand,
                            LegendPositionsCommand legendPositionsCommand, ContourLinesCommand contourLinesCommand,
                            ColorAssigmentCommand colorAssigmentCommand,
                            RescaleCommand rescaleCommand, EditChartCommand editChartCommand,
                            EditChartPropertiesCommand editChartPropertiesCommand,
                            PrintChartCommand printChartCommand, PrintPreviewChartCommand printPreviewChartCommand)
            : base(MenuStrings.chartToolStripMenuItem_Text)
        {
            _sharedViewState = sharedViewState;
            BindingUtils.OnPropertyChanged(_sharedViewState, nameof(_sharedViewState.CurrentView),
                                           () => IsEnabled = _sharedViewState.CurrentView == ViewName.Charting);

            ChildrenCommands = new List <IToolbarCommand>
            {
                exportCommand,
                null,
                //rozne
                typeOfChartCommand,
                colorsCommand,
                legendPositionsCommand,
                contourLinesCommand,
                colorAssigmentCommand,
                rescaleCommand,
                null,
                editChartCommand,
                editChartPropertiesCommand,
                null,
                printChartCommand,
                printPreviewChartCommand
            };
        }
Ejemplo n.º 10
0
        private static void RenderErrorInfoAsJson(ExportCommand command, Exception exception)
        {
            List <Exception> exceptions = new List <Exception>();

            if (exception != null)
            {
                if (exception is Parser.MultiParserException)
                {
                    exceptions.AddRange(((Parser.MultiParserException)exception).ParseExceptions);
                }
                else
                {
                    exceptions.Add(exception);
                }
            }

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            sb.Append("{ \"errors\": [");
            for (int i = 0; i < exceptions.Count; ++i)
            {
                if (i > 0)
                {
                    sb.Append(',');
                }
                Parser.FileScope       fileInfo        = null;
                Parser.Token           tokenInfo       = null;
                string                 message         = exceptions[i].Message;
                Parser.ParserException parserException = exceptions[i] as Parser.ParserException;
                if (parserException != null)
                {
                    fileInfo  = parserException.File;
                    tokenInfo = parserException.TokenInfo;
                    message   = parserException.OriginalMessage;
                }
                sb.Append("\n  {");
                if (fileInfo != null)
                {
                    sb.Append("\n    \"file\": \"");
                    sb.Append(fileInfo.Name.Replace("\\", "\\\\"));
                    sb.Append("\",");
                }
                if (tokenInfo != null)
                {
                    sb.Append("\n    \"col\": ");
                    sb.Append(tokenInfo.Col + 1);
                    sb.Append(",");
                    sb.Append("\n    \"line\": ");
                    sb.Append(tokenInfo.Line + 1);
                    sb.Append(",");
                }
                sb.Append("\n    \"message\": \"");
                sb.Append(message.Replace("\\", "\\\\").Replace("\"", "\\\""));
                sb.Append("\"\n  }");
            }
            sb.Append(" ] }");
            string output = sb.ToString();

            WriteCompileInformation(output);
        }
Ejemplo n.º 11
0
 private void InvalidateCommands()
 {
     RaisePropertyChanged(() => IsSessionActive);
     CloseCommand.RaiseCanExecuteChanged();
     ExportCommand.RaiseCanExecuteChanged();
     ConnectCommand.RaiseCanExecuteChanged();
     DisconnectCommand.RaiseCanExecuteChanged();
 }
Ejemplo n.º 12
0
        public void SerializeTest()
        {
            var command      = new ExportCommand(ProviderType.Fsx, @"C:\123", true);
            var elem         = command.Serialize("command1");
            var deserialized = ExportCommand.Deserialize(elem);

            Assert.IsTrue(command.Equals(deserialized));
        }
Ejemplo n.º 13
0
        public void ExportCommandTest()
        {
            Console.WriteLine(@"ExportCommandTest");
            var cmd = new ExportCommand(this, ExportObject.Chart, ExportType.Pdf);

            Assert.AreEqual(ExportObject.Chart, cmd.ExportObject);
            Assert.AreEqual(ExportType.Pdf, cmd.ExportType);
        }
Ejemplo n.º 14
0
        public void LoadCommands()
        {
            ResetFilterCommand = new RelayCommand(parameter =>
            {
                FilterText = string.Empty;
            });

            LoadModalCommand = new RelayCommand(parameter =>
            {
                if (parameter == null)
                {
                    return;
                }

                ModalPage page;
                if (Enum.TryParse(parameter.ToString(), out page))
                {
                    if (page != ModalPage.None)
                    {
                        SelectedModalPage = page;
                        IsModalVisible    = true;
                    }

                    ExportCode = string.Empty;

                    if (page == ModalPage.Export)
                    {
                        ExportCommand.Execute(parameter);
                    }
                }

                Logger.Log("Selecting modal content... {0}", parameter.ToString());
            });

            CloseModalCommand = new RelayCommand(parameter =>
            {
                IsModalVisible = false;
            });

            ImportCommand = new RelayCommand(parameter =>
            {
                Logger.Log("Importing ItemList...");

                var oldSlected = _selectedItems.Count;

                ImportFromCode(ExportCode);

                Logger.Log("Selected Before = {0} After = {1}", oldSlected, _selectedItems.Count);

                IsModalVisible = false;
            });

            ExportCommand = new RelayCommand(parameter =>
            {
                Logger.Log("Exporting ItemList... {0}", parameter);
                ExportCode = CreateExportCode();
            });
        }
Ejemplo n.º 15
0
        private async Task <bool> LaunchFilePickerAndExportAsync()
        {
            bool processIsSuccessful = false;

            FileSavePicker savePicker = new FileSavePicker
            {
                SuggestedStartLocation = PickerLocationId.Downloads,
                SuggestedFileName      = "PhiliaContacts"
            };

            savePicker.FileTypeChoices.Add("Virtual Contact File", new List <string>()
            {
                ".vcf"
            });

            StorageFile file = await savePicker.PickSaveFileAsync();

            if (file != null)
            {
                try
                {
                    IsBusy = true;

                    CachedFileManager.DeferUpdates(file);

                    await FileIO.WriteTextAsync(file, Writer.Write(Manager));

                    Windows.Storage.Provider.FileUpdateStatus status = await CachedFileManager.CompleteUpdatesAsync(file);

                    processIsSuccessful = status == Windows.Storage.Provider.FileUpdateStatus.Complete;

                    if (processIsSuccessful)
                    {
                        if (WorkflowSuccessAction != null)
                        {
                            WorkflowSuccessAction.Invoke();
                        }
                    }
                    else
                    {
                        if (WorkflowFailureAction != null)
                        {
                            WorkflowFailureAction.Invoke();
                        }
                    }
                }
                finally
                {
                    DispatcherHelper.CheckBeginInvokeOnUI(() =>
                    {
                        IsBusy = false;
                        ExportCommand.RaiseCanExecuteChanged();
                    });
                }
            }

            return(processIsSuccessful);
        }
Ejemplo n.º 16
0
        public void NotValidExport_CollectionMissing()
        {
            var c = new ExportCommand();

            c.Parse("--uri mongocon --query {}".Split(' '));
            Assert.Equal("mongocon", c.Connection);
            Assert.Equal("{}", c.SearchQueryForExport);
            Assert.Throws <ArgumentException>(() => c.Validate());
        }
Ejemplo n.º 17
0
        private async Task <Operation> ExportAsync(DatabaseSmugglerExportOptions options, Func <Stream, Task> handleStreamResponse, Task additionalTask, CancellationToken token = default)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }
            if (_requestExecutor == null)
            {
                throw new InvalidOperationException("Cannot use Smuggler without a database defined, did you forget to call ForDatabase?");
            }

            using (_requestExecutor.ContextPool.AllocateOperationContext(out JsonOperationContext context))
            {
                var getOperationIdCommand = new GetNextOperationIdCommand();
                await _requestExecutor.ExecuteAsync(getOperationIdCommand, context, sessionInfo : null, token : token).ConfigureAwait(false);

                var operationId = getOperationIdCommand.Result;

                var tcs = new TaskCompletionSource <object>(TaskCreationOptions.RunContinuationsAsynchronously);
                var cancellationTokenRegistration = token.Register(() => tcs.TrySetCanceled(token));

                var command     = new ExportCommand(_requestExecutor.Conventions, context, options, handleStreamResponse, operationId, tcs);
                var requestTask = _requestExecutor.ExecuteAsync(command, context, sessionInfo: null, token: token)
                                  .ContinueWith(t =>
                {
                    cancellationTokenRegistration.Dispose();
                    if (t.IsFaulted)
                    {
                        tcs.TrySetException(t.Exception);

                        if (Logger.IsOperationsEnabled)
                        {
                            Logger.Operations("Could not execute export", t.Exception);
                        }
                    }
                }, token);

                try
                {
                    await tcs.Task.ConfigureAwait(false);
                }
                catch (Exception)
                {
                    await requestTask.ConfigureAwait(false);

                    await tcs.Task.ConfigureAwait(false);
                }

                return(new Operation(
                           _requestExecutor,
                           () => _store.Changes(_databaseName),
                           _requestExecutor.Conventions,
                           operationId,
                           null,
                           additionalTask));
            }
        }
Ejemplo n.º 18
0
        public BuildContext DoWorkImpl(ExportCommand command)
        {
            string buildFile = command.BuildFilePath;
            string target    = command.BuildTarget;

            if (buildFile == null || target == null)
            {
                throw new InvalidOperationException("Build file and target must be specified together.");
            }

            buildFile = BuildContext.GetValidatedCanonicalBuildFilePath(buildFile);

            string projectDirectory = FileUtil.GetParentDirectory(buildFile);

            BuildContext buildContext = null;

            buildContext = BuildContext.Parse(projectDirectory, FileUtil.ReadFileText(buildFile), target, command.ResourceErrorsShowRelativeDir);

            buildContext = buildContext ?? new BuildContext();

            // command line arguments override build file values if present.

            if (buildContext.Platform == null)
            {
                throw new InvalidOperationException("No platform specified in build file.");
            }

            if (buildContext.TopLevelAssembly.SourceFolders.Length == 0)
            {
                throw new InvalidOperationException("No source folder specified in build file.");
            }

            if (buildContext.OutputFolder == null)
            {
                throw new InvalidOperationException("No output folder specified in build file.");
            }

            buildContext.OutputFolder = FileUtil.JoinAndCanonicalizePath(projectDirectory, buildContext.OutputFolder);

            if (buildContext.LaunchScreenPath != null)
            {
                buildContext.LaunchScreenPath = FileUtil.JoinAndCanonicalizePath(projectDirectory, buildContext.LaunchScreenPath);
            }

            foreach (FilePath sourceFolder in buildContext.TopLevelAssembly.SourceFolders)
            {
                if (!FileUtil.DirectoryExists(sourceFolder.AbsolutePath))
                {
                    throw new InvalidOperationException("Source folder does not exist.");
                }
            }

            buildContext.ProjectID = buildContext.ProjectID ?? "Untitled";

            return(buildContext);
        }
Ejemplo n.º 19
0
 private static void ParseAdditionalArgs(ExportCommand command, Dictionary <string, string> args)
 {
     command.ShowPerformanceMarkers        = args.ContainsKey(SHOW_PERFORMANCE_MARKERS);
     command.ShowLibraryDepTree            = args.ContainsKey(LIBRARY_DEP_TREE);
     command.IsErrorCheckOnly              = args.ContainsKey(ERROR_CHECK_ONLY);
     command.IsJsonOutput                  = args.ContainsKey(JSON_OUTPUT);
     command.UseOutputPrefixes             = args.ContainsKey(USE_OUTPUT_PREFIXES);
     command.OutputDirectoryOverride       = args.ContainsKey(OVERRIDE_OUTPUT_DIR) ? args[OVERRIDE_OUTPUT_DIR] : null;
     command.ResourceErrorsShowRelativeDir = args.ContainsKey(RESOURCE_ERRORS_SHOW_RELATIVE_DIR);
 }
Ejemplo n.º 20
0
        protected override void OnSelectedItem(BarEntryModel item)
        {
            base.OnSelectedItem(item);

            ExportCommand.CanExecute(SelectedItem);
            ImportCommand.CanExecute(SelectedItem);
            OpenItemCommand.CanExecute(SelectedItem);

            OnPropertyChanged(nameof(ExportFileName));
        }
Ejemplo n.º 21
0
        public void ValidExport()
        {
            var c = new ExportCommand();

            c.Parse("--uri mongocon --query {} --collection countries".Split(' '));
            Assert.Equal("mongocon", c.Connection);
            Assert.Equal("{}", c.SearchQueryForExport);
            Assert.Equal("countries", (c as ExportCommand).CollectionName);
            c.Validate();
        }
Ejemplo n.º 22
0
        public override CrayonWorkerResult DoWorkImpl(CrayonWorkerResult[] args)
        {
            ExportCommand command = (ExportCommand)args[0].Value;

            Platform.AbstractPlatform standaloneVmPlatform = command.PlatformProvider.GetPlatform(command.VmPlatform);
            return(new CrayonWorkerResult()
            {
                Value = standaloneVmPlatform
            });
        }
Ejemplo n.º 23
0
        private static ExportCommand GenerateExportCommand(Dictionary <string, string> args)
        {
            ExportCommand command = new ExportCommand();

            if (args.Count == 0)
            {
                command.IsEmpty = true;
            }

            if (args.ContainsKey(GEN_DEFAULT_PROJ))
            {
                command.DefaultProjectId     = args[GEN_DEFAULT_PROJ].Trim();
                command.DefaultProjectLocale = "EN";
            }
            if (args.ContainsKey(GEN_DEFAULT_PROJ_ES))
            {
                command.DefaultProjectId     = args[GEN_DEFAULT_PROJ_ES].Trim();
                command.DefaultProjectLocale = "ES";
            }
            if (args.ContainsKey(GEN_DEFAULT_PROJ_JP))
            {
                command.DefaultProjectId     = args[GEN_DEFAULT_PROJ_JP].Trim();
                command.DefaultProjectLocale = "JP";
            }

            if (args.ContainsKey(BUILD_FILE))
            {
                command.BuildFilePath = args[BUILD_FILE].Trim();
            }
            if (args.ContainsKey(BUILD_TARGET))
            {
                command.BuildTarget = args[BUILD_TARGET].Trim();
            }
            if (args.ContainsKey(VM_DIR))
            {
                command.VmExportDirectory = args[VM_DIR].Trim();
            }
            if (args.ContainsKey(VM))
            {
                command.VmPlatform = args[VM].Trim();
            }
            if (args.ContainsKey(CBX))
            {
                command.CbxExportPath = args[CBX].Trim();
            }
            if (args.ContainsKey(VERSION))
            {
                command.ShowVersion = true;
            }

            ParseAdditionalArgs(command, args);

            return(command);
        }
Ejemplo n.º 24
0
        public static void Run(ExportCommand command)
        {
            string           vmTargetDir = new GetTargetVmExportDirectoryWorker().DoWorkImpl(command);
            AbstractPlatform platform    = command.PlatformProvider.GetPlatform(command.VmPlatform);

            AssemblyMetadata[] assemblyMetadataList           = new AssemblyFinder().AssemblyFlatList;
            Dictionary <string, FileOutput> fileOutputContext = new Dictionary <string, FileOutput>();

            new ExportStandaloneVmSourceCodeForPlatformWorker().DoWorkImpl(fileOutputContext, platform, assemblyMetadataList, vmTargetDir, command);
            new EmitFilesToDiskWorker().DoWorkImpl(fileOutputContext, vmTargetDir);
        }
Ejemplo n.º 25
0
        public ExportCommand DoWorkImpl()
        {
            string[] commandLineArgs = Program.GetCommandLineArgs();

            ExportCommand command = FlagParser.Parse(commandLineArgs);

            // TODO: I don't like this here.
            command.PlatformProvider = new PlatformProvider();

            return(command);
        }
Ejemplo n.º 26
0
        public void GetFileString_FieldHasNewLine_ChangedToSpaces()
        {
            var exporter = new ExportCommand();
            var s1       = new List <FieldInstance>(new[] {
                new FieldInstance("a", "string", "1" + Environment.NewLine + "2")
            });
            var result = exporter.GetFileString(new[] { s1 });
            var lines  = result.Split('\n').Select(l => l.TrimEnd()).ToArray();

            Assert.AreEqual("1 2", lines[1]);
        }
Ejemplo n.º 27
0
        public override CrayonWorkerResult DoWorkImpl(CrayonWorkerResult[] args)
        {
            ExportCommand     command           = (ExportCommand)args[0].Value;
            BuildContext      buildContext      = (BuildContext)args[1].Value;
            CompilationBundle compilationResult = this.ExportVmBundle(command, buildContext);

            return(new CrayonWorkerResult()
            {
                Value = compilationResult
            });
        }
        public void ProjectExport_Execute_ReturnsNotFoundMessage()
        {
            var command = new ExportCommand(_console, LoggerMock.GetLogger <ExportCommand>().Object, _projectService.Object, _templateWriter.Object)
            {
                Name = "Project 2",
            };

            var resultMessage = command.Execute();

            Assert.Equal("Project Project 2 was not found", resultMessage);
        }
        public void ProjectExport_Execute_ReturnsSuccessMessage()
        {
            var command = new ExportCommand(_console, LoggerMock.GetLogger <ExportCommand>().Object, _projectService.Object, _templateWriter.Object)
            {
                Name = "Project 1"
            };

            var resultMessage = command.Execute();

            Assert.Equal("Project has been exported to Project 1", resultMessage);
        }
Ejemplo n.º 30
0
 public MainViewModel()
 {
     DatagridPreviewCommand           = new DatagridPreviewCommand(this);
     PartitionsDatagridPreviewCommand = new PartitionsDatagridPreviewCommand(this);
     OpenCommand           = new OpenCommand(this);
     ExportCommand         = new ExportCommand(this);
     OpenHelpCommand       = new OpenHelpCommand();
     OpenAboutCommand      = new OpenAboutCommand();
     CloseWindowCommand    = new CloseWindowCommand();
     PartitionsViewCommand = new PartitionsViewCommand(this);
 }