コード例 #1
0
        public async Task when_generating_readme_without_commands_then_readme_is_generated()
        {
            var descriptor = new GenerateReadmeCommandDescriptorTest();

            var command = new GenerateReadmeCommand(descriptor);

            await command.ExecuteAsync(output);

            Assert.Equal(ExpectedReadmeWithoutCommands, File.ReadAllText(descriptor.OutputFile));
        }
コード例 #2
0
        public async Task when_generating_readme_with_commands_and_read_command_template_fails_then_readme_is_generated_without_commands()
        {
            var descriptor = new GenerateReadmeCommandDescriptorTest()
                             .WithCommand("test", new TestCommandDescriptor(), () => throw new FileNotFoundException("template not found"));

            var command = new GenerateReadmeCommand(descriptor);

            await command.ExecuteAsync(output);

            Assert.Equal(ExpectedReadmeWithoutCommands, File.ReadAllText(descriptor.OutputFile));
        }
コード例 #3
0
        public async Task when_generating_readme_with_commands_then_readme_is_generated()
        {
            var descriptor = new GenerateReadmeCommandDescriptorTest()
                             .WithCommand("test", new TestCommandDescriptor(), () => TestCommandTemplate);

            var command = new GenerateReadmeCommand(descriptor);

            await command.ExecuteAsync(output);

            Assert.Equal(ExpectedReadmeWithTestCommand, File.ReadAllText(descriptor.OutputFile));
        }
コード例 #4
0
        public async Task when_generating_readme_without_output_file_then_readme_is_generated()
        {
            var command = new GenerateReadmeCommand(new GenerateReadmeCommandDescriptorTest()
            {
                OutputFile = null
            });

            var sb = new StringBuilder();
            await command.ExecuteAsync(new RecordTextWriter(sb, output));

            Assert.Contains(ExpectedReadmeWithoutCommands, sb.ToString());
        }