Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
440cf7f
Hide foreground customization in fonts and colors
tonyhallett Jan 20, 2024
ebbb9af
backup
tonyhallett Jan 24, 2024
12a759a
working
tonyhallett Jan 25, 2024
895d1cf
backup
tonyhallett Jan 26, 2024
6af40c4
correct auto load guids
tonyhallett Jan 27, 2024
7f8c742
backup
tonyhallett Jan 28, 2024
f80e4a3
backup
tonyhallett Jan 29, 2024
3f1425e
backup
tonyhallett Jan 30, 2024
78cefcc
backup
tonyhallett Jan 30, 2024
e86472b
implementation change on interface
tonyhallett Jan 31, 2024
7149fc2
options and readme for github and marketplace
tonyhallett Jan 31, 2024
b10431f
fix failing tests
tonyhallett Jan 31, 2024
de26dbb
test for soln close clears ui
tonyhallett Jan 31, 2024
4a0e4e9
add bold
tonyhallett Jan 31, 2024
74a2779
WCAG Green
tonyhallett Jan 31, 2024
cc44ab1
Use Initialize instead of setter
tonyhallett Jan 31, 2024
fd6a5f6
backup
tonyhallett Jan 31, 2024
98689f6
backup
tonyhallett Feb 1, 2024
0128691
backup
tonyhallett Feb 1, 2024
f18251a
backup
tonyhallett Feb 2, 2024
21d59e6
backup
tonyhallett Feb 2, 2024
52943a2
backup
tonyhallett Feb 2, 2024
8fe180a
backup
tonyhallett Feb 2, 2024
eee7d01
glyph tagger to check HasCoverage before raising
tonyhallett Feb 3, 2024
c1dbfed
don't raise tags changed when options change and no coverage
tonyhallett Feb 3, 2024
bd5bd26
backup
tonyhallett Feb 3, 2024
9d3eb8d
backup
tonyhallett Feb 4, 2024
71a3b7a
backup
tonyhallett Feb 4, 2024
56a6a9e
back up of dynamic line coverage
tonyhallett Feb 5, 2024
92973c0
backup
tonyhallett Feb 6, 2024
9df0ee0
backup
tonyhallett Feb 7, 2024
b84c793
backup
tonyhallett Feb 9, 2024
5de7aab
backup
tonyhallett Feb 9, 2024
9b96744
backup
tonyhallett Feb 9, 2024
8c6e74d
backup
tonyhallett Feb 9, 2024
6c8b29b
backup
tonyhallett Feb 9, 2024
7841843
move files to folders
tonyhallett Feb 10, 2024
1ec682e
folders and namespaces
tonyhallett Feb 10, 2024
c93e29d
more tests
tonyhallett Feb 10, 2024
e847772
backup
tonyhallett Feb 11, 2024
2e78b25
backup
tonyhallett Feb 12, 2024
11774cb
backup
tonyhallett Feb 12, 2024
f0421dd
backup
tonyhallett Feb 12, 2024
23e7f51
backup
tonyhallett Feb 12, 2024
e1f012d
backup
tonyhallett Feb 12, 2024
0c2b86d
backup
tonyhallett Feb 12, 2024
48f77a9
backup
tonyhallett Feb 12, 2024
25afddc
backup
tonyhallett Feb 12, 2024
e9c57ca
backup
tonyhallett Feb 13, 2024
45f0bf1
correct behaviour
tonyhallett Feb 16, 2024
fd29b0c
refactor TrackingSpanRange to have just start and end tracking spans
tonyhallett Feb 16, 2024
4c96858
refactoring TrackingSpanRange
tonyhallett Feb 16, 2024
e740a2a
remove isEmpty as removed once empty
tonyhallett Feb 16, 2024
303857e
refactor ContainingCodeTracker
tonyhallett Feb 16, 2024
7b029f1
backup ok
tonyhallett Feb 17, 2024
7c8117e
ItextBuffer2 background
tonyhallett Feb 17, 2024
73d5e6e
backup
tonyhallett Feb 18, 2024
171c4eb
backup
tonyhallett Feb 18, 2024
fd63ec1
pre refactor to ITrackedNewCodeLine
tonyhallett Feb 19, 2024
3732c54
pre LineTracker refactor
tonyhallett Feb 20, 2024
00fb134
pre TrackingSpanRange refactor
tonyhallett Feb 20, 2024
17b03bc
backup
tonyhallett Feb 20, 2024
4b8956c
pre updating Management to DynamicCoverageType
tonyhallett Feb 21, 2024
70354a5
pre refactor to IVsFontAndColorDefaultsProvider.
tonyhallett Feb 21, 2024
dab32ae
backup
tonyhallett Feb 23, 2024
18e2145
backup
tonyhallett Feb 24, 2024
b2d0dbf
all tests
tonyhallett Feb 24, 2024
31ad6e1
options and readme
tonyhallett Feb 25, 2024
b3dcc08
corrected test for options
tonyhallett Feb 25, 2024
2c7b4c6
separate categories for editor coloring
tonyhallett Feb 25, 2024
41a32d0
file for type
tonyhallett Feb 25, 2024
9301f91
no adjustment of dynamic line
tonyhallett Feb 25, 2024
0de5265
backup - test changes to follow
tonyhallett Feb 26, 2024
5b11b81
updated most tests
tonyhallett Feb 26, 2024
2215b30
refactor and more tests
tonyhallett Feb 27, 2024
425aee2
working deserialization for roslyn - tests to follow
tonyhallett Feb 28, 2024
6316ec3
nearly there
tonyhallett Feb 29, 2024
ba96458
refactor
tonyhallett Feb 29, 2024
1fb9798
roslyn incorporated in new code - tests to follow
tonyhallett Feb 29, 2024
36f8e33
almost complete. Next appoption for control
tonyhallett Mar 1, 2024
7ba91ae
Functioning !
tonyhallett Mar 1, 2024
82f9e5c
Better NewCodeTracker
tonyhallett Mar 2, 2024
b9e9620
update readme
tonyhallett Mar 2, 2024
42b1633
refactor tests
tonyhallett Mar 2, 2024
702e655
readonly
tonyhallett Mar 2, 2024
cd2a7a0
editorconfig pt1
tonyhallett Mar 3, 2024
a684749
editorconfig pt2
tonyhallett Mar 3, 2024
3f9ad72
more editorconfig
tonyhallett Mar 3, 2024
a30eb07
editorconfig
tonyhallett Mar 3, 2024
e0a4c7d
editorconfig
tonyhallett Mar 3, 2024
c3f971d
editorconfig
tonyhallett Mar 3, 2024
1b81b48
editorconfig
tonyhallett Mar 3, 2024
9dd19e3
editorconfig
tonyhallett Mar 3, 2024
7c803a8
editorconfig
tonyhallett Mar 3, 2024
7401533
backup
tonyhallett Mar 3, 2024
86204c0
refactor and other lines get set fix
tonyhallett Mar 4, 2024
64f4789
formatting
tonyhallett Mar 4, 2024
0e0ed80
cleanup profile2
tonyhallett Mar 4, 2024
f56155a
Distinct codespanrange
tonyhallett Mar 5, 2024
359e15a
line numbers changed
tonyhallett Mar 5, 2024
f21d026
code clean up
tonyhallett Mar 5, 2024
6212a3e
test CoberturaUtil / further FileLineCoverage tests
tonyhallett Mar 6, 2024
e5517ae
remove intermediate classes from deserialized report
tonyhallett Mar 6, 2024
5a3fc50
refactor CoverageColours
tonyhallett Mar 6, 2024
48bccf1
formatting
tonyhallett Mar 7, 2024
a939328
fix error where taking coverageLines of other file
tonyhallett Mar 7, 2024
559f952
rename
tonyhallett Mar 7, 2024
941420e
remove preview image
tonyhallett Mar 7, 2024
3c23790
Update assets
tonyhallett Mar 7, 2024
2fce23b
code cleanup
tonyhallett Mar 7, 2024
e938cf8
fix reflected field name - test
tonyhallett Mar 7, 2024
7e088f4
Ignore test failing on github actions only
tonyhallett Mar 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ x64/
*.ncrunchproject
_NCrunch_WebCompiler
/MSBuild_Logs
/MigrationBackup/f1627d49/FineCodeCoverageTests
Binary file modified Art/Options-Global.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Art/Output-Coverage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Art/Output-RiskHotspots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Art/Output-Summary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Art/preview-coverage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion FineCodeCoverage.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FineCodeCoverage", "FineCod
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{208EE360-4076-4680-A9B7-2BA9C17EA9FB}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
.github\workflows\addVsixLinkToIssues.yaml = .github\workflows\addVsixLinkToIssues.yaml
Expand Down
25 changes: 24 additions & 1 deletion FineCodeCoverage/FineCodeCoverage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,38 @@
<PackageReference Include="Microsoft.Build.Locator">
<Version>1.4.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Common">
<Version>3.11.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp">
<Version>3.11.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.EditorFeatures.Text">
<Version>3.11.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic">
<Version>3.11.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common">
<Version>3.11.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild">
<Version>3.8.0</Version>
<Version>3.11.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Composition.Analyzers">
<Version>16.9.20</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="16.0.206" ExcludeAssets="runtime">
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.TestWindow.Interfaces">
<Version>11.0.61030</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers">
<Version>17.9.28</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.8.3038">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand Down
1 change: 0 additions & 1 deletion FineCodeCoverage/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<MoreInfo>https://marketplace.visualstudio.com/items?itemName=FortuneNgwenya.FineCodeCoverage</MoreInfo>
<License>Resources\LICENSE</License>
<Icon>Resources\logo.png</Icon>
<PreviewImage>Resources\preview-coverage.png</PreviewImage>
<Tags>visual studio; code coverage; c#; vb; .net core; coverlet; unit test; free; community edition</Tags>
</Metadata>
<Installation>
Expand Down
30 changes: 28 additions & 2 deletions FineCodeCoverage2022/FineCodeCoverage2022.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>TRACE;DEBUG;VS2022</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
Expand Down Expand Up @@ -145,15 +145,38 @@
<PackageReference Include="Microsoft.Build.Locator">
<Version>1.4.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Common">
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp">
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.EditorFeatures.Text">
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic">
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common">
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild">
<Version>4.0.1</Version>
<Version>4.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Composition.Analyzers">
<Version>17.7.40</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.1.32210.191" ExcludeAssets="runtime">
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.TestWindow.Interfaces">
<Version>11.0.61030</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers">
<Version>17.9.28</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.1.4054">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
Expand All @@ -167,6 +190,9 @@
<PackageReference Include="RSA.Fizzler.Systems.HtmlAgilityPack">
<Version>1.0.0</Version>
</PackageReference>
<PackageReference Include="StreamJsonRpc">
<Version>2.16.36</Version>
</PackageReference>
<PackageReference Include="Svg">
<Version>3.3.0</Version>
</PackageReference>
Expand Down
3 changes: 3 additions & 0 deletions FineCodeCoverage2022/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

[assembly: InternalsVisibleTo("FineCodeCoverageTests")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
1 change: 0 additions & 1 deletion FineCodeCoverage2022/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
<MoreInfo>https://marketplace.visualstudio.com/items?itemName=FortuneNgwenya.FineCodeCoverage</MoreInfo>
<License>Resources\LICENSE</License>
<Icon>Resources\logo.png</Icon>
<PreviewImage>Resources\preview-coverage.png</PreviewImage>
<Tags>visual studio; code coverage; c#; vb; .net core; coverlet; unit test; free; community edition</Tags>
</Metadata>
<Installation>
Expand Down
43 changes: 36 additions & 7 deletions FineCodeCoverageTests/AppOptionsProvider_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using AutoMoq;
using FineCodeCoverage.Core.Utilities;
using FineCodeCoverage.Options;
using Microsoft.VisualStudio.Settings;
using Moq;
using NUnit.Framework;

Expand All @@ -13,16 +14,16 @@ public class AppOptionsProvider_Tests
{
private AutoMoqer autoMocker;
private AppOptionsProvider appOptionsProvider;
private Mock<IWritableSettingsStore> mockWritableSettingsStore;
private Mock<WritableSettingsStore> mockWritableSettingsStore;

[SetUp]
public void Setup()
{
autoMocker = new AutoMoqer();
appOptionsProvider = autoMocker.Create<AppOptionsProvider>();
mockWritableSettingsStore = new Mock<IWritableSettingsStore>();
var mockWritableSettingsStoreProvider = autoMocker.GetMock<IWritableSettingsStoreProvider>();
mockWritableSettingsStoreProvider.Setup(
mockWritableSettingsStore = new Mock<WritableSettingsStore>();
var mockWritableUserSettingsStoreProvider = autoMocker.GetMock<IWritableUserSettingsStoreProvider>();
mockWritableUserSettingsStoreProvider.Setup(
writableSettingsStoreProvider => writableSettingsStoreProvider.Provide()
).Returns(mockWritableSettingsStore.Object);
}
Expand Down Expand Up @@ -205,7 +206,16 @@ public void Should_Not_Default_Any_Other_AppOptions_Properties()
nameof(IAppOptions.ShowPartiallyCoveredInOverviewMargin),
nameof(IAppOptions.ShowToolWindowToolbar),
nameof(IAppOptions.Hide0Coverable),
nameof(IAppOptions.DisabledNoCoverage)
nameof(IAppOptions.DisabledNoCoverage),
nameof(IAppOptions.ShowEditorCoverage),
nameof(IAppOptions.ShowCoverageInGlyphMargin),
nameof(IAppOptions.ShowCoveredInGlyphMargin),
nameof(IAppOptions.ShowUncoveredInGlyphMargin),
nameof(IAppOptions.ShowPartiallyCoveredInGlyphMargin),
nameof(IAppOptions.ShowLineCoveredHighlighting),
nameof(IAppOptions.ShowLinePartiallyCoveredHighlighting),
nameof(IAppOptions.ShowLineUncoveredHighlighting),
nameof(IAppOptions.UseEnterpriseFontsAndColors)
};
CollectionAssert.AreEquivalent(expectedSetters.Select(s => $"set_{s}"), invocationNames);
}
Expand Down Expand Up @@ -273,7 +283,6 @@ internal void Should_Use_Deseralized_String_From_Store_For_AppOption_Property(Fu
{ nameof(IAppOptions.AttributesInclude), new string[]{ "ainclude"}},
{ nameof(IAppOptions.CompanyNamesExclude), new string[]{ "cexclude"}},
{ nameof(IAppOptions.CompanyNamesInclude), new string[]{ "cinclude"}},
{ nameof(IAppOptions.CoverageColoursFromFontsAndColours), true},
{ nameof(IAppOptions.CoverletCollectorDirectoryPath), "p"},
{ nameof(IAppOptions.CoverletConsoleCustomPath), "cp"},
{ nameof(IAppOptions.CoverletConsoleGlobal), true},
Expand Down Expand Up @@ -313,14 +322,34 @@ internal void Should_Use_Deseralized_String_From_Store_For_AppOption_Property(Fu
{ nameof(IAppOptions.ShowCoverageInOverviewMargin),true},
{ nameof(IAppOptions.ShowCoveredInOverviewMargin),true},
{ nameof(IAppOptions.ShowPartiallyCoveredInOverviewMargin),true},
{ nameof(IAppOptions.ShowDirtyInOverviewMargin), true },
{ nameof(IAppOptions.ShowNewInOverviewMargin), true },
{ nameof(IAppOptions.ShowUncoveredInOverviewMargin),true},
{ nameof(IAppOptions.ShowNotIncludedInOverviewMargin),true},
{ nameof(IAppOptions.ShowToolWindowToolbar),true},
{nameof(IAppOptions.ExcludeAssemblies),new string[]{ "Exclude"} },
{nameof(IAppOptions.IncludeAssemblies),new string[]{ "Include"} },
{nameof(IAppOptions.NamespaceQualification),NamespaceQualification.AlwaysUnqualified },
{nameof(IAppOptions.OpenCoverRegister),OpenCoverRegister.Default },
{nameof(IAppOptions.OpenCoverTarget),"" },
{nameof(IAppOptions.OpenCoverTargetArgs),"" }
{nameof(IAppOptions.OpenCoverTargetArgs),"" },
{nameof(IAppOptions.ShowEditorCoverage),true },
{nameof(IAppOptions.ShowCoverageInGlyphMargin),true },
{nameof(IAppOptions.ShowCoveredInGlyphMargin),true },
{nameof(IAppOptions.ShowPartiallyCoveredInGlyphMargin),true },
{nameof(IAppOptions.ShowUncoveredInGlyphMargin),true },
{nameof(IAppOptions.ShowDirtyInGlyphMargin),true },
{nameof(IAppOptions.ShowNewInGlyphMargin),true },
{nameof(IAppOptions.ShowNotIncludedInGlyphMargin),true },
{nameof(IAppOptions.ShowLineCoverageHighlighting),true },
{nameof(IAppOptions.ShowLineCoveredHighlighting),true },
{nameof(IAppOptions.ShowLinePartiallyCoveredHighlighting),true },
{nameof(IAppOptions.ShowLineUncoveredHighlighting),true },
{nameof(IAppOptions.ShowLineDirtyHighlighting),true },
{nameof(IAppOptions.ShowLineNewHighlighting),true },
{nameof(IAppOptions.ShowLineNotIncludedHighlighting),true },
{nameof(IAppOptions.UseEnterpriseFontsAndColors),true },
{nameof(IAppOptions.EditorCoverageColouringMode), EditorCoverageColouringMode.UseRoslynWhenTextChanges }
};
var mockJsonConvertService = autoMocker.GetMock<IJsonConvertService>();
mockJsonConvertService.Setup(
Expand Down
63 changes: 63 additions & 0 deletions FineCodeCoverageTests/CoberturaDeserializer_Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using NUnit.Framework;
using System.IO;
using FineCodeCoverage.Engine.Cobertura;
using System;
using System.Linq;

namespace FineCodeCoverageTests
{
public class CoberturaDeserializer_Tests
{
[Test]
public void Should_Deserialize_What_Is_Required()
{
var cobertura = @"<?xml version=""1.0"" encoding=""utf-8""?>
<!DOCTYPE coverage SYSTEM ""http://cobertura.sourceforge.net/xml/coverage-04.dtd"">
<coverage line-rate=""0.127074535991358"" branch-rate=""0.101282051282051"" lines-covered=""1294"" lines-valid=""10183"" branches-covered=""395"" branches-valid=""3900"" complexity=""5304"" version=""1"" timestamp=""1709634604"">
<sources />
<packages>
<package name=""DemoOpenCover"" line-rate=""0.0271464646464646"" branch-rate=""0.5"" complexity=""537"">
<classes>
<class name="".LargeClass"" filename=""C:\Users\tonyh\source\repos\DemoOpenCover\DemoOpenCover\LargeClass.cs"" line-rate=""1"" branch-rate=""1"" complexity=""501"">
<methods>
<method name=""Method0"" signature=""()"" line-rate=""1"" branch-rate=""1"" complexity=""1"">
<lines>
<line number=""1"" hits=""1"" branch=""false"" />
</lines>
</method>
</methods>
<lines>
<line number=""1"" hits=""1"" branch=""true"" />
</lines>
</class>
</classes>
</package>
</packages>
</coverage>
";

string fileName = System.IO.Path.GetTempPath() + Guid.NewGuid().ToString() + ".xml";
File.WriteAllText(fileName, cobertura);
var report = new CoberturaDerializer().Deserialize(fileName);
var package = report.Packages.Single();
Assert.AreEqual("DemoOpenCover", package.Name);
var packageClass = package.Classes.Single();
Assert.AreEqual(".LargeClass", packageClass.Name);
Assert.AreEqual(@"C:\Users\tonyh\source\repos\DemoOpenCover\DemoOpenCover\LargeClass.cs", packageClass.Filename);
Assert.AreEqual(1, packageClass.LineRate);
Assert.AreEqual(1, packageClass.BranchRate);
Assert.AreEqual(501, packageClass.Complexity);
var method = packageClass.Methods.Single();
Assert.AreEqual("Method0", method.Name);
Assert.AreEqual("()", method.Signature);
Assert.AreEqual(1, method.LineRate);
Assert.AreEqual(1, method.BranchRate);
var line = method.Lines.Single();
Assert.AreEqual(1, line.Number);
Assert.AreEqual(1, line.Hits);
line = packageClass.Lines.Single();
Assert.AreEqual(1, line.Number);
Assert.AreEqual(1, line.Hits);
}
}
}
Loading