예제 #1
0
        public void Execute()
        {
            while (_generationCount <= _config.MaximumGenerations)
            {
                var generationViewModel = new GenerationViewModel(_board.GetGrid(), _generationCount);

                _presenter.Display(generationViewModel);
                _timer.Sleep(_config.AnimationDelay);
                _board.UpdateToNextGeneration();
                Tick();
            }
        }
예제 #2
0
        internal int OnExecute()
        {
            try
            {
                _logger.LogTrace("Generator List Command - OnExecute");

                _presenter.GeneratorConfiguration.Update(target: Target, localFolder: LocalFolder,
                                                         serverFolder: ServerFolder, verbose: Verbose);

                var local = Path.Combine(_presenter.GeneratorConfiguration.LocalFolder,
                                         _presenter.GeneratorConfiguration.Target);

                _console.WriteLine("Available generators:");
                _console.WriteLine($"  Local: {local}");
                _console.WriteLine(_presenter.Display());
                if (string.IsNullOrWhiteSpace(_presenter.GeneratorConfiguration.ServerFolder))
                {
                    return(0);
                }

                var server = Path.Combine(_presenter.GeneratorConfiguration.ServerFolder,
                                          _presenter.GeneratorConfiguration.Target);
                _console.WriteLine();
                _console.WriteLine($"  Server: {server}");
                _console.WriteLine(_presenter.Display(true));

                return(0);
            }
            catch (Exception ex)
            {
                _logger.LogError(LoggingEvents.ListError, ex, "List command failed");
                return(1);
            }
            finally
            {
                _logger.LogTrace("Generator List Command - complete");
            }
        }
예제 #3
0
            // ReSharper disable once UnusedMember.Local
            internal int OnExecute()
            {
                try
                {
                    _logger.LogTrace("Generator List Command - OnExecute");

                    _presenter.GeneratorConfiguration.LocalFolder = LocalFolder;
                    _presenter.GeneratorConfiguration.Target      = Target;
                    _presenter.GeneratorConfiguration.Verbose     = Verbose;

                    _presenter.Display();
                    return(0);
                }
                catch (Exception ex)
                {
                    _logger.LogError(LoggingEvents.ListError, ex, "List command failed");
                    return(1);
                }
                finally
                {
                    _logger.LogTrace("Generator List Command - complete");
                }
            }
        public void Display_Should_Call_Clear_Once()
        {
            _presenter.Display(_testGenerationViewModel);

            _spyWriter.Verify(w => w.Clear(), Times.Once());
        }