@@ -6,44 +6,7 @@ public class CodeClimateIntegrationTests
66 public void Should_Parse_Sample_CodeClimate_Output ( )
77 {
88 // Given
9- var sampleJson = @"[
10- {
11- ""type"": ""issue"",
12- ""check_name"": ""EditorConfig/indent_style"",
13- ""description"": ""Wrong indentation type (expected: space, found: tab)"",
14- ""categories"": [""Style""],
15- ""location"": {
16- ""path"": ""src/example.js"",
17- ""lines"": {
18- ""begin"": 5,
19- ""end"": 5
20- }
21- },
22- ""severity"": ""minor""
23- },
24- {
25- ""type"": ""issue"",
26- ""check_name"": ""complexity"",
27- ""description"": ""Function has too many parameters"",
28- ""categories"": [""Complexity""],
29- ""location"": {
30- ""path"": ""src/complex.ts"",
31- ""positions"": {
32- ""begin"": {
33- ""line"": 15,
34- ""column"": 5
35- },
36- ""end"": {
37- ""line"": 18,
38- ""column"": 10
39- }
40- }
41- },
42- ""severity"": ""critical""
43- }
44- ]" ;
45-
46- var fixture = new CodeClimateIssuesProviderFixture ( sampleJson ) ;
9+ var fixture = new CodeClimateIssuesProviderFixture ( "integration_test.json" ) ;
4710
4811 // When
4912 var issues = fixture . ReadIssues ( ) . ToList ( ) ;
@@ -52,33 +15,32 @@ public void Should_Parse_Sample_CodeClimate_Output()
5215 issues . Count . ShouldBe ( 2 ) ;
5316
5417 // Check first issue (line-based)
55- var firstIssue = issues . First ( i => i . Rule == "EditorConfig/indent_style" ) ;
56- firstIssue . Message . ShouldBe ( "Wrong indentation type (expected: space, found: tab)" ) ;
18+ var firstIssue = issues . First ( i => i . Rule ( ) == "EditorConfig/indent_style" ) ;
19+ firstIssue . Message ( IssueCommentFormat . PlainText ) . ShouldBe ( "Wrong indentation type (expected: space, found: tab)" ) ;
5720 firstIssue . AffectedFileRelativePath ? . ToString ( ) . ShouldBe ( @"src\example.js" ) ;
5821 firstIssue . Line . ShouldBe ( 5 ) ;
5922 firstIssue . EndLine . ShouldBe ( 5 ) ;
60- firstIssue . Priority . ShouldBe ( IssuePriority . Suggestion ) ;
23+ firstIssue . Priority . ShouldBe ( ( int ) IssuePriority . Suggestion ) ;
6124
6225 // Check second issue (position-based)
63- var secondIssue = issues . First ( i => i . Rule == "complexity" ) ;
64- secondIssue . Message . ShouldBe ( "Function has too many parameters" ) ;
26+ var secondIssue = issues . First ( i => i . Rule ( ) == "complexity" ) ;
27+ secondIssue . Message ( IssueCommentFormat . PlainText ) . ShouldBe ( "Function has too many parameters" ) ;
6528 secondIssue . AffectedFileRelativePath ? . ToString ( ) . ShouldBe ( @"src\complex.ts" ) ;
6629 secondIssue . Line . ShouldBe ( 15 ) ;
6730 secondIssue . EndLine . ShouldBe ( 18 ) ;
6831 secondIssue . Column . ShouldBe ( 5 ) ;
6932 secondIssue . EndColumn . ShouldBe ( 10 ) ;
70- secondIssue . Priority . ShouldBe ( IssuePriority . Error ) ;
33+ secondIssue . Priority . ShouldBe ( ( int ) IssuePriority . Error ) ;
7134 }
7235
7336 private sealed class CodeClimateIssuesProviderFixture : BaseConfigurableIssueProviderFixture < CodeClimateIssuesProvider , CodeClimateIssuesSettings >
7437 {
75- public CodeClimateIssuesProviderFixture ( string fileContent )
76- : base ( fileContent )
38+ public CodeClimateIssuesProviderFixture ( string fileResourceName )
39+ : base ( fileResourceName )
7740 {
41+ this . ReadIssuesSettings = new ReadIssuesSettings ( @"C:\build\" ) ;
7842 }
7943
80- protected override string FilePathPrefix => "C:\\ build\\ " ;
81-
82- protected override string FilePathSuffix => "log.json" ;
44+ protected override string FileResourceNamespace => "Cake.Issues.CodeClimate.Tests.Testfiles." ;
8345 }
8446}
0 commit comments