1- // Copyright (c) Toni Solarin-Sodara
1+ // Copyright (c) Toni Solarin-Sodara
22// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
4+ using System ;
45using Coverlet . Core . Abstractions ;
56using Moq ;
6- using System ;
77using Xunit ;
88
99namespace Coverlet . Core . Reporters . Tests
1010{
11- public class JsonReporterTests
11+ public class JsonReporterTests
12+ {
13+ [ Fact ]
14+ public void TestReport ( )
1215 {
13- [ Fact ]
14- public void TestReport ( )
15- {
16- var result = new CoverageResult ( ) ;
17- result . Identifier = Guid . NewGuid ( ) . ToString ( ) ;
18-
19- var lines = new Lines ( ) ;
20- lines . Add ( 1 , 1 ) ;
21- lines . Add ( 2 , 0 ) ;
22-
23- var methods = new Methods ( ) ;
24- string methodString = "System.Void Coverlet.Core.Reporters.Tests.JsonReporterTests.TestReport()" ;
25- methods . Add ( methodString , new Method ( ) ) ;
26- methods [ methodString ] . Lines = lines ;
27-
28- var classes = new Classes ( ) ;
29- classes . Add ( "Coverlet.Core.Reporters.Tests.JsonReporterTests" , methods ) ;
30-
31- var documents = new Documents ( ) ;
32- documents . Add ( "doc.cs" , classes ) ;
33-
34- result . Modules = new Modules ( ) ;
35- result . Modules . Add ( "module" , documents ) ;
36-
37- var reporter = new JsonReporter ( ) ;
38- Assert . NotEqual ( "{\n }" , reporter . Report ( result , new Mock < ISourceRootTranslator > ( ) . Object ) ) ;
39- Assert . NotEqual ( string . Empty , reporter . Report ( result , new Mock < ISourceRootTranslator > ( ) . Object ) ) ;
40- }
16+ var result = new CoverageResult ( ) ;
17+ result . Identifier = Guid . NewGuid ( ) . ToString ( ) ;
18+
19+ var lines = new Lines ( ) ;
20+ lines . Add ( 1 , 1 ) ;
21+ lines . Add ( 2 , 0 ) ;
22+
23+ var methods = new Methods ( ) ;
24+ string methodString = "System.Void Coverlet.Core.Reporters.Tests.JsonReporterTests.TestReport()" ;
25+ methods . Add ( methodString , new Method ( ) ) ;
26+ methods [ methodString ] . Lines = lines ;
27+
28+ var classes = new Classes ( ) ;
29+ classes . Add ( "Coverlet.Core.Reporters.Tests.JsonReporterTests" , methods ) ;
30+
31+ var documents = new Documents ( ) ;
32+ documents . Add ( "doc.cs" , classes ) ;
33+
34+ result . Modules = new Modules ( ) ;
35+ result . Modules . Add ( "module" , documents ) ;
36+
37+ var reporter = new JsonReporter ( ) ;
38+ string resultJson = reporter . Report ( result , new Mock < ISourceRootTranslator > ( ) . Object ) ;
39+ Assert . NotEqual ( "{\n }" , resultJson ) ;
40+ Assert . NotEqual ( string . Empty , resultJson ) ;
41+ Assert . Contains ( "Lines" , resultJson ) ;
42+ Assert . Contains ( "Branches" , resultJson ) ;
4143 }
42- }
44+ }
45+ }
0 commit comments