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); }
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); }
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); }
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); }