コード例 #1
0
    static int Init(InitOptions options)
    {
        var updateChecker = CheckForUpdates();
        var exitCode      = InitCommand.Run(GetConfig(new Config.CLIInitCommandConfig(options)));

        WriteUpdateNotification(updateChecker);
        return(exitCode);
    }
コード例 #2
0
        public void Run_should_write_example_yaml()
        {
            // given
            var fileProvider = new FileProviderMock();

            fileProvider.CurrentDirectory = "mypath/";
            string expectedPath = Path.Combine(fileProvider.GetCurrentDirectory(), "remy.yml");

            var locator = new ServiceLocatorMock();
            var command = new InitCommand(fileProvider);

            command.Logger = _logger;

            // when
            command.Run(locator);

            // then
            Assert.That(fileProvider.FileWriteContent, Is.Not.Null);
            Assert.That(fileProvider.FileWritePath, Is.Not.Null);

            Assert.That(fileProvider.FileWriteContent, Does.Contain("echo 'Hello from Remy!'"));
            Assert.That(fileProvider.FileWritePath, Is.EqualTo(expectedPath));
            Assert.That(_logStringBuilder.ToString(), Does.Contain("Example remy.yml file written"));
        }