-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
… for DocFxMetadata
- Loading branch information
1 parent
4763548
commit a8bc79a
Showing
6 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/Cake.DocFx.Tests/Metadata/DocFxMetadataRunnerFixture.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Cake.Core.IO; | ||
using Cake.DocFx.Metadata; | ||
|
||
namespace Cake.DocFx.Tests.Metadata | ||
{ | ||
internal sealed class DocFxMetadataRunnerFixture : DocFxFixture<DocFxMetadataSettings> | ||
{ | ||
public DocFxMetadataRunnerFixture() | ||
{ | ||
} | ||
|
||
protected override void RunTool() | ||
{ | ||
var tool = new DocFxMetadataRunner(FileSystem, Environment, ProcessRunner, Tools); | ||
tool.Run(Settings); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using Xunit; | ||
|
||
namespace Cake.DocFx.Tests.Metadata | ||
{ | ||
public class DocFxMetadataRunnerTests | ||
{ | ||
public sealed class TheRunMethod | ||
{ | ||
[Fact] | ||
public void Should_Add_LogPath_To_Arguments_If_Set() | ||
{ | ||
// Given | ||
var fixture = new DocFxMetadataRunnerFixture | ||
{ | ||
Settings = { LogPath = @"c:\temp\docfx.log" } | ||
}; | ||
|
||
// When | ||
var result = fixture.Run(); | ||
|
||
// Then | ||
Assert.Equal("metadata -l \"c:/temp/docfx.log\"", result.Args); | ||
} | ||
|
||
[Theory] | ||
[InlineData(DocFxLogLevel.Error, "Error")] | ||
[InlineData(DocFxLogLevel.Warning, "Warning")] | ||
[InlineData(DocFxLogLevel.Info, "Info")] | ||
[InlineData(DocFxLogLevel.Verbose, "Verbose")] | ||
public void Should_Add_LogLevel_To_Arguments_If_Set(DocFxLogLevel logLevel, string expectedLevel) | ||
{ | ||
// Given | ||
var fixture = new DocFxMetadataRunnerFixture | ||
{ | ||
Settings = { LogLevel = logLevel } | ||
}; | ||
|
||
// When | ||
var result = fixture.Run(); | ||
|
||
// Then | ||
Assert.Equal("metadata --logLevel \"" + expectedLevel + "\"", result.Args); | ||
} | ||
|
||
[Fact] | ||
public void Should_Not_Add_LogLevel_To_Arguments_If_Default() | ||
{ | ||
// Given | ||
var fixture = new DocFxMetadataRunnerFixture | ||
{ | ||
Settings = { LogLevel = DocFxLogLevel.Default } | ||
}; | ||
|
||
// When | ||
var result = fixture.Run(); | ||
|
||
// Then | ||
Assert.Equal("metadata", result.Args); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters