Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH2439: Fix the numeric values of the enumeration #2450

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using Cake.Common.Tests.Fixtures.Tools;
using Cake.Common.Tools.ReportGenerator;
using Cake.Core;
Expand Down Expand Up @@ -156,18 +157,34 @@ public void Should_Set_Reports_And_Target_Directory()
Assert.Equal("\"-reports:/Working/report1.xml;/Working/report2.xml\" \"-targetdir:/Working/output\"", result.Args);
}

[Fact]
public void Should_Set_Report_Types()
[Theory]
[InlineData("Badges", 1)]
[InlineData("Html", 2)]
[InlineData("HtmlSummary", 3)]
[InlineData("Latex", 4)]
[InlineData("LatexSummary", 5)]
[InlineData("TextSummary", 6)]
[InlineData("Xml", 7)]
[InlineData("XmlSummary", 8)]
[InlineData("Cobertura", 9)]
[InlineData("CsvSummary", 10)]
[InlineData("HtmlChart", 11)]
[InlineData("HtmlInline", 12)]
[InlineData("HtmlInlineAzurePipelines", 13)]
[InlineData("PngChart", 14)]
[InlineData("MHtml", 15)]
public void Should_Set_Report_Types(string expected, int enumValue)
{
// Given
var fixture = new ReportGeneratorRunnerFixture();
fixture.Settings.ReportTypes = new[] { ReportGeneratorReportType.Html, ReportGeneratorReportType.Latex };
fixture.Settings.ReportTypes = new[] { (ReportGeneratorReportType)enumValue };

// When
var result = fixture.Run();

// Then
Assert.Equal("\"-reports:/Working/report.xml\" \"-targetdir:/Working/output\" \"-reporttypes:Html;Latex\"", result.Args);
Assert.True(Enum.IsDefined(typeof(ReportGeneratorReportType), enumValue));
Assert.Equal($"\"-reports:/Working/report.xml\" \"-targetdir:/Working/output\" \"-reporttypes:{expected}\"", result.Args);
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ public enum ReportGeneratorReportType
/// <summary>
/// Same as HTMLInline but with modified CSS that matches the look and feel of Azure Pipelines.
/// </summary>
HtmlInline_AzurePipelines = 13,
HtmlInlineAzurePipelines = 13,

/// <summary>
/// Same as HTML but packaged into a single MHTML file.
/// A single PNG file containing a chart with historic coverage information.
/// </summary>
MHtml = 13,
PngChart = 14,

/// <summary>
/// A single PNG file containing a chart with historic coverage information.
/// Same as HTML but packaged into a single MHTML file.
/// </summary>
PngChart = 14
MHtml = 15
}
}