Skip to content

Commit 0b9e546

Browse files
committed
Fixed warnings and messages
1 parent c705ae0 commit 0b9e546

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+187
-196
lines changed

src/ReportGenerator.Core.Test/Parser/Analysis/ClassTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void AddFile_AddSingleFile_FileIsStored()
3737
{
3838
var assembly = new Assembly("C:\\test\\TestAssembly.dll");
3939
var sut = new Class("Test", assembly);
40-
var file = new CodeFile("C:\\temp\\Program.cs", new int[0], new LineVisitStatus[0]);
40+
var file = new CodeFile("C:\\temp\\Program.cs", System.Array.Empty<int>(), System.Array.Empty<LineVisitStatus>());
4141
sut.AddFile(file);
4242

4343
Assert.Equal(file, sut.Files.First());

src/ReportGenerator.Core.Test/Parser/Analysis/CodeFileTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,9 @@ public void AnalyzeFile_AdditionFileReaderReturnsError_RegularFileReaderUsed()
324324
[Fact]
325325
public void CodeFile_Equals()
326326
{
327-
var target1 = new CodeFile("C:\\temp\\Program.cs", new int[0], new LineVisitStatus[0]);
328-
var target2 = new CodeFile("C:\\temp\\Program.cs", new int[0], new LineVisitStatus[0]);
329-
var target3 = new CodeFile("C:\\temp\\Other.cs", new int[0], new LineVisitStatus[0]);
327+
var target1 = new CodeFile("C:\\temp\\Program.cs", System.Array.Empty<int>(), System.Array.Empty<LineVisitStatus>());
328+
var target2 = new CodeFile("C:\\temp\\Program.cs", System.Array.Empty<int>(), System.Array.Empty<LineVisitStatus>());
329+
var target3 = new CodeFile("C:\\temp\\Other.cs", System.Array.Empty<int>(), System.Array.Empty<LineVisitStatus>());
330330

331331
Assert.True(target1.Equals(target2), "Objects are not equal");
332332
Assert.False(target1.Equals(target3), "Objects are equal");
@@ -340,7 +340,7 @@ public void CodeFile_Equals()
340340
[Fact]
341341
public void AddCoverageByTestMethod_AddCoverageByTestMethodForExistingMethod_CoverageInformationIsMerged()
342342
{
343-
var sut = new CodeFile("C:\\temp\\Program.cs", new int[0], new LineVisitStatus[0]);
343+
var sut = new CodeFile("C:\\temp\\Program.cs", System.Array.Empty<int>(), System.Array.Empty<LineVisitStatus>());
344344
var testMethod = new TestMethod("TestFull", "Test");
345345

346346
var coverageByTrackedMethod = new CoverageByTrackedMethod() { Coverage = new int[] { -1, -1, -1, -1, 0, 0, 0, 1, 1, 1 }, LineVisitStatus = new LineVisitStatus[] { LineVisitStatus.NotCoverable, LineVisitStatus.NotCoverable, LineVisitStatus.NotCoverable, LineVisitStatus.NotCoverable, LineVisitStatus.NotCovered, LineVisitStatus.NotCovered, LineVisitStatus.NotCovered, LineVisitStatus.Covered, LineVisitStatus.Covered, LineVisitStatus.Covered } };

src/ReportGenerator.Core.Test/Parser/CloverParserTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class CloverParserTest
2121
{
2222
private static readonly string FilePath1 = Path.Combine(FileManager.GetJavaReportDirectory(), "Clover_OpenClover4.3.1.xml");
2323

24-
private ParserResult parserResult;
24+
private readonly ParserResult parserResult;
2525

2626
public CloverParserTest()
2727
{

src/ReportGenerator.Core.Test/Parser/CoberturaParserTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class CoberturaParserTest
2121
{
2222
private static readonly string FilePath1 = Path.Combine(FileManager.GetJavaReportDirectory(), "Cobertura2.1.1.xml");
2323

24-
private ParserResult parserResult;
24+
private readonly ParserResult parserResult;
2525

2626
public CoberturaParserTest()
2727
{

src/ReportGenerator.Core.Test/Parser/CoverageReportParserTest.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Palmmedia.ReportGenerator.Core.Test.Parser
1414
[Collection("FileManager")]
1515
public class CoverageReportParserTest
1616
{
17-
private Mock<IFilter> filterMock = new Mock<IFilter>();
17+
private readonly Mock<IFilter> filterMock = new Mock<IFilter>();
1818

1919
public CoverageReportParserTest()
2020
{
@@ -28,10 +28,10 @@ public CoverageReportParserTest()
2828
public void ParseFiles_SingleReportFileWithSingleReport_PartCoverNotSupported()
2929
{
3030
string filePath = Path.Combine(FileManager.GetCSharpReportDirectory(), "Partcover2.3.xml");
31-
Assert.Throws<UnsupportedParserException>(() => new CoverageReportParser(1, 1, new string[0], this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }));
31+
Assert.Throws<UnsupportedParserException>(() => new CoverageReportParser(1, 1, System.Array.Empty<string>(), this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }));
3232

3333
filePath = Path.Combine(FileManager.GetCSharpReportDirectory(), "Partcover2.2.xml");
34-
Assert.Throws<UnsupportedParserException>(() => new CoverageReportParser(1, 1, new string[0], this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }));
34+
Assert.Throws<UnsupportedParserException>(() => new CoverageReportParser(1, 1, System.Array.Empty<string>(), this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }));
3535
}
3636

3737
/// <summary>
@@ -107,10 +107,10 @@ public void ParseFiles_SingleReportFileWithSingleReport_CorrectParserIsReturned(
107107
public void ParseFiles_SingleReportFileWithSeveralReports_PartCoverNotSupported()
108108
{
109109
string filePath = Path.Combine(FileManager.GetCSharpReportDirectory(), "MultiPartcover2.3.xml");
110-
Assert.Throws<UnsupportedParserException>(() => new CoverageReportParser(1, 1, new string[0], this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }));
110+
Assert.Throws<UnsupportedParserException>(() => new CoverageReportParser(1, 1, System.Array.Empty<string>(), this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }));
111111

112112
filePath = Path.Combine(FileManager.GetCSharpReportDirectory(), "MultiPartcover2.2.xml");
113-
Assert.Throws<UnsupportedParserException>(() => new CoverageReportParser(1, 1, new string[0], this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }));
113+
Assert.Throws<UnsupportedParserException>(() => new CoverageReportParser(1, 1, System.Array.Empty<string>(), this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }));
114114
}
115115

116116
/// <summary>
@@ -120,23 +120,23 @@ public void ParseFiles_SingleReportFileWithSeveralReports_PartCoverNotSupported(
120120
public void ParseFiles_SingleReportFileWithSeveralReports_CorrectParserIsReturned()
121121
{
122122
string filePath = Path.Combine(FileManager.GetCSharpReportDirectory(), "MultiNCover1.5.8.xml");
123-
string parserName = new CoverageReportParser(1, 1, new string[0], this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }).ParserName;
123+
string parserName = new CoverageReportParser(1, 1, System.Array.Empty<string>(), this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }).ParserName;
124124
Assert.Equal("MultiReportParser (2x NCoverParser)", parserName);
125125

126126
filePath = Path.Combine(FileManager.GetCSharpReportDirectory(), "MultiOpenCover.xml");
127-
parserName = new CoverageReportParser(1, 1, new string[0], this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }).ParserName;
127+
parserName = new CoverageReportParser(1, 1, System.Array.Empty<string>(), this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }).ParserName;
128128
Assert.Equal("MultiReportParser (2x OpenCoverParser)", parserName);
129129

130130
filePath = Path.Combine(FileManager.GetCSharpReportDirectory(), "MultidotCover.xml");
131-
parserName = new CoverageReportParser(1, 1, new string[0], this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }).ParserName;
131+
parserName = new CoverageReportParser(1, 1, System.Array.Empty<string>(), this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }).ParserName;
132132
Assert.Equal("MultiReportParser (2x DotCoverParser)", parserName);
133133

134134
filePath = Path.Combine(FileManager.GetCSharpReportDirectory(), "MultiVisualStudio2010.coveragexml");
135-
parserName = new CoverageReportParser(1, 1, new string[0], this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }).ParserName;
135+
parserName = new CoverageReportParser(1, 1, System.Array.Empty<string>(), this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }).ParserName;
136136
Assert.Equal("MultiReportParser (2x VisualStudioParser)", parserName);
137137

138138
filePath = Path.Combine(FileManager.GetCSharpReportDirectory(), "MultiDynamicCodeCoverage.xml");
139-
parserName = new CoverageReportParser(1, 1, new string[0], this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }).ParserName;
139+
parserName = new CoverageReportParser(1, 1, System.Array.Empty<string>(), this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath }).ParserName;
140140
Assert.Equal("MultiReportParser (2x DynamicCodeCoverageParser)", parserName);
141141
}
142142

@@ -148,7 +148,7 @@ public void ParseFiles_SeveralReportFilesWithSingleReport_CorrectParserIsReturne
148148
{
149149
string filePath = Path.Combine(FileManager.GetCSharpReportDirectory(), "OpenCover.xml");
150150
string filePath2 = Path.Combine(FileManager.GetCSharpReportDirectory(), "NCover1.5.8.xml");
151-
string parserName = new CoverageReportParser(1, 1, new string[0], this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath, filePath2 }).ParserName;
151+
string parserName = new CoverageReportParser(1, 1, System.Array.Empty<string>(), this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath, filePath2 }).ParserName;
152152
Assert.Equal("MultiReportParser (1x NCoverParser, 1x OpenCoverParser)", parserName);
153153
}
154154

@@ -160,7 +160,7 @@ public void ParseFiles_SeveralReportFilesWithSeveralReports_CorrectParserIsRetur
160160
{
161161
string filePath = Path.Combine(FileManager.GetCSharpReportDirectory(), "NCover1.5.8.xml");
162162
string filePath2 = Path.Combine(FileManager.GetCSharpReportDirectory(), "MultiOpenCover.xml");
163-
string parserName = new CoverageReportParser(1, 1, new string[0], this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath, filePath2 }).ParserName;
163+
string parserName = new CoverageReportParser(1, 1, System.Array.Empty<string>(), this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { filePath, filePath2 }).ParserName;
164164
Assert.Equal("MultiReportParser (1x NCoverParser, 2x OpenCoverParser)", parserName);
165165
}
166166

@@ -170,7 +170,7 @@ public void ParseFiles_SeveralReportFilesWithSeveralReports_CorrectParserIsRetur
170170
[Fact]
171171
public void ParseFiles_NoReports_CorrectParserIsReturned()
172172
{
173-
string parserName = new CoverageReportParser(1, 1, new string[0], this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { string.Empty }).ParserName;
173+
string parserName = new CoverageReportParser(1, 1, System.Array.Empty<string>(), this.filterMock.Object, this.filterMock.Object, this.filterMock.Object).ParseFiles(new string[] { string.Empty }).ParserName;
174174
Assert.Equal(string.Empty, parserName);
175175
}
176176
}

src/ReportGenerator.Core.Test/Parser/DotCoverParserTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class DotCoverParserTest
2020
{
2121
private static readonly string FilePath1 = Path.Combine(FileManager.GetCSharpReportDirectory(), "dotCover.xml");
2222

23-
private ParserResult parserResult;
23+
private readonly ParserResult parserResult;
2424

2525
public DotCoverParserTest()
2626
{

src/ReportGenerator.Core.Test/Parser/DynamicCodeCoverageParserTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class DynamicCodeCoverageParserTest
2020
{
2121
private static readonly string FilePath = Path.Combine(FileManager.GetCSharpReportDirectory(), "DynamicCodeCoverage.xml");
2222

23-
private ParserResult parserResult;
23+
private readonly ParserResult parserResult;
2424

2525
public DynamicCodeCoverageParserTest()
2626
{

src/ReportGenerator.Core.Test/Parser/Filtering/DefaultFilterTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class DefaultFilterTest
1212
[Fact]
1313
public void NoFilter_AnyElement_ElementIsAccepted()
1414
{
15-
IFilter filter = new DefaultFilter(new string[] { });
15+
IFilter filter = new DefaultFilter(System.Array.Empty<string>());
1616

1717
Assert.True(filter.IsElementIncludedInReport("Test"), "Element is expected to be included.");
1818
Assert.True(filter.IsElementIncludedInReport("test"), "Element is expected to be included.");

src/ReportGenerator.Core.Test/Parser/GCovParserTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class GCovParserTest
2020
{
2121
private static readonly string FilePath = Path.Combine(FileManager.GetCPlusPlusReportDirectory(), "gcov", "branch_unconditional", "main.cpp.gcov");
2222

23-
private ParserResult parserResult;
23+
private readonly ParserResult parserResult;
2424

2525
public GCovParserTest()
2626
{

src/ReportGenerator.Core.Test/Parser/JaCoCoParserTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class JaCoCoParserTest
2121
{
2222
private static readonly string FilePath1 = Path.Combine(FileManager.GetJavaReportDirectory(), "JaCoCo0.8.3.xml");
2323

24-
private ParserResult parserResult;
24+
private readonly ParserResult parserResult;
2525

2626
public JaCoCoParserTest()
2727
{

0 commit comments

Comments
 (0)