Beispiel #1
0
        public void LoadConfiguration_file_reads_configuration_file_if_path_is_specified(MarkdownPreset preset)
        {
            // ARRANGE
            using var temporaryDirectory = new TemporaryDirectory();
            var configPath = Path.Combine(temporaryDirectory, "config.json");

            File.WriteAllText(configPath, $@"{{
                ""mddocs"" : {{                    
                    ""commandlineHelp"" : {{
                        ""template"" : {{
                            ""default"" : {{
                                ""markdownPreset"" : ""{preset}""
                            }}
                        }}
                    }}
                }}
            }}");

            var sut = new GenerateCommandLineDocumentation()
            {
                Assembly          = new TaskItem("myAssembly.dll"),
                BuildEngine       = new BuildEngineMock(),
                OutputDirectory   = new TaskItem("my-output-directory"),
                ConfigurationFile = new TaskItem(configPath)
            };

            // ACT
            var config = sut.GetConfigurationProvider().GetCommandLineHelpConfiguration();

            // ASSERT
            Assert.Equal(preset, config.Template.Default.MarkdownPreset);
        }
Beispiel #2
0
        public void AssemblyPath_overrides_assembly_path_setting()
        {
            // ARRANGE
            var sut = new GenerateCommandLineDocumentation()
            {
                Assembly    = new TaskItem("my-assembly.dll"),
                BuildEngine = new BuildEngineMock()
            };

            var expectedPath = Path.GetFullPath("my-assembly.dll");

            // ACT
            var config = sut.GetConfigurationProvider().GetCommandLineHelpConfiguration();

            // ASSERT
            Assert.Equal(expectedPath, config.AssemblyPath);
        }
Beispiel #3
0
        public void OutputDirectoryPath_returns_empty_string_if_OutputDirectory_is_null()
        {
            // ARRANGE
            var sut = new GenerateCommandLineDocumentation()
            {
                Assembly        = new TaskItem("my-assembly.dll"),
                BuildEngine     = new BuildEngineMock(),
                OutputDirectory = null
            };

            // ACT
            var outputDirectoryPath = sut.OutputDirectoryPath;

            // ASSERT
            Assert.NotNull(outputDirectoryPath);
            Assert.Equal("", outputDirectoryPath);
        }
Beispiel #4
0
        public void AssemblyPath_returns_full_path()
        {
            // ARRANGE
            var sut = new GenerateCommandLineDocumentation()
            {
                Assembly    = new TaskItem("my-assembly.dll"),
                BuildEngine = new BuildEngineMock()
            };

            var expectedPath = Path.GetFullPath("my-assembly.dll");

            // ACT
            var actualPath = sut.AssemblyPath;

            // ASSERT
            Assert.True(Path.IsPathRooted(actualPath));
            Assert.Equal(expectedPath, actualPath);
        }