diff --git a/src/SQLCover/SQLCover/CoverageResult.cs b/src/SQLCover/SQLCover/CoverageResult.cs index 195462f..eae32f2 100644 --- a/src/SQLCover/SQLCover/CoverageResult.cs +++ b/src/SQLCover/SQLCover/CoverageResult.cs @@ -137,19 +137,92 @@ public string Html() transform: rotate(-135deg); -webkit-transform: rotate(-135deg); } + + +"); + builder.Append( + ""); - .covered-statement{ - background-color: greenyellow; + builder.AppendFormat("", "Total", + statements, coveredStatements, (float)coveredStatements / (float)statements * 100.0); + + foreach ( + var batch in + _batches.Where(p => !p.ObjectName.Contains("tSQLt")) + .OrderByDescending(p => (float)p.CoveredStatementCount / (float)p.StatementCount)) + { + builder.AppendFormat( + "", + batch.ObjectName, batch.StatementCount, batch.CoveredStatementCount, + (float)batch.CoveredStatementCount / (float)batch.StatementCount * 100.0); + } + + builder.Append("
object namestatement countcovered statement countcoverage %
{0}{1}{2}{3:0.00}
{0}{1}{2}{3:0.00}
"); + + foreach (var b in _batches) + { + builder.AppendFormat("
", b.ObjectName); + + var tempBuffer = b.Text; + foreach (var statement in b.Statements.OrderByDescending(p => p.Offset)) + { + if (statement.HitCount > 0) + { + var start = tempBuffer.Substring(0, statement.Offset + statement.Length); + var end = tempBuffer.Substring(statement.Offset + statement.Length); + tempBuffer = start + "" + end; + + start = tempBuffer.Substring(0, statement.Offset); + end = tempBuffer.Substring(statement.Offset); + tempBuffer = start + "" + end; + } + } + + builder.Append(tempBuffer + "
"); + } + + + builder.AppendFormat(""); + + return builder.ToString(); } - - table{ - background-color: lightgrey; + + public string Html2() + { + var statements = _batches.Sum(p => p.StatementCount); + var coveredStatements = _batches.Sum(p => p.CoveredStatementCount); + + var builder = new StringBuilder(); + + builder.Append(@" + + SQLCover Code Coverage Results + diff --git a/src/SQLCover/SQLCover/SQLCover.csproj b/src/SQLCover/SQLCover/SQLCover.csproj index c592997..1564b22 100644 --- a/src/SQLCover/SQLCover/SQLCover.csproj +++ b/src/SQLCover/SQLCover/SQLCover.csproj @@ -32,22 +32,22 @@ - ..\packages\Microsoft.SqlServer.DacFx.x64.150.4200.1\lib\net46\Microsoft.Data.Tools.Schema.Sql.dll + ..\packages\Microsoft.SqlServer.DacFx.x64.150.4538.1\lib\net46\Microsoft.Data.Tools.Schema.Sql.dll - ..\packages\Microsoft.SqlServer.DacFx.x64.150.4200.1\lib\net46\Microsoft.Data.Tools.Utilities.dll + ..\packages\Microsoft.SqlServer.DacFx.x64.150.4538.1\lib\net46\Microsoft.Data.Tools.Utilities.dll - ..\packages\Microsoft.SqlServer.DacFx.x64.150.4200.1\lib\net46\Microsoft.SqlServer.Dac.dll + ..\packages\Microsoft.SqlServer.DacFx.x64.150.4538.1\lib\net46\Microsoft.SqlServer.Dac.dll - ..\packages\Microsoft.SqlServer.DacFx.x64.150.4200.1\lib\net46\Microsoft.SqlServer.Dac.Extensions.dll + ..\packages\Microsoft.SqlServer.DacFx.x64.150.4538.1\lib\net46\Microsoft.SqlServer.Dac.Extensions.dll - ..\packages\Microsoft.SqlServer.DacFx.x64.150.4200.1\lib\net46\Microsoft.SqlServer.TransactSql.ScriptDom.dll + ..\packages\Microsoft.SqlServer.DacFx.x64.150.4538.1\lib\net46\Microsoft.SqlServer.TransactSql.ScriptDom.dll - ..\packages\Microsoft.SqlServer.DacFx.x64.150.4200.1\lib\net46\Microsoft.SqlServer.Types.dll + ..\packages\Microsoft.SqlServer.DacFx.x64.150.4538.1\lib\net46\Microsoft.SqlServer.Types.dll diff --git a/src/SQLCover/SQLCover/packages.config b/src/SQLCover/SQLCover/packages.config index 57bdb9f..83fd995 100644 --- a/src/SQLCover/SQLCover/packages.config +++ b/src/SQLCover/SQLCover/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/src/SQLCover/releases/template/SQLCover.ps1 b/src/SQLCover/releases/template/SQLCover.ps1 index 349df58..8085175 100644 --- a/src/SQLCover/releases/template/SQLCover.ps1 +++ b/src/SQLCover/releases/template/SQLCover.ps1 @@ -124,6 +124,16 @@ function Export-Html{ $result.SaveSourceFiles($outputPath) } +function Export-Html2{ + param( + [SQLCover.CoverageResult] $result + ,[string]$outputPath + ) + + $xmlPath = Join-Path -Path $outputPath -ChildPath "Coverage2.html" + $result.Html2() | Out-File $xmlPath + $result.SaveSourceFiles($outputPath) +} #EXAMPLE: <# diff --git a/src/SQLCover/test/SQLCover.IntegrationTests/ConnectionStringReader.cs b/src/SQLCover/test/SQLCover.IntegrationTests/ConnectionStringReader.cs index fa01aa2..dba120f 100644 --- a/src/SQLCover/test/SQLCover.IntegrationTests/ConnectionStringReader.cs +++ b/src/SQLCover/test/SQLCover.IntegrationTests/ConnectionStringReader.cs @@ -55,7 +55,8 @@ public static string GetIntegration() else { // var connectionString = $"Server=np:{GetPipeName()};integrated security=sspi;initial catalog=DatabaseProject"; - var connectionString = $"Server=tcp:{GetContainerIP()};uid=sa;pwd=Psgsgsfsfs!!!!!;initial catalog=DatabaseProject"; + //var connectionString = $"Server=tcp:{GetContainerIP()};uid=sa;pwd=Psgsgsfsfs!!!!!;initial catalog=DatabaseProject"; + var connectionString = "Server=(localdb)\\SQLCover;integrated security=SSPI;initial catalog=DatabaseProject"; return connectionString; } } diff --git a/src/SQLCover/test/SQLCover.UnitTests/SQLCover.UnitTests.csproj b/src/SQLCover/test/SQLCover.UnitTests/SQLCover.UnitTests.csproj index a04c2f8..aafa219 100644 --- a/src/SQLCover/test/SQLCover.UnitTests/SQLCover.UnitTests.csproj +++ b/src/SQLCover/test/SQLCover.UnitTests/SQLCover.UnitTests.csproj @@ -36,22 +36,28 @@ - ..\..\packages\Microsoft.SqlServer.DacFx.x64.150.4200.1\lib\net46\Microsoft.Data.Tools.Schema.Sql.dll + ..\..\packages\Microsoft.SqlServer.DacFx.x64.150.4538.1\lib\net46\Microsoft.Data.Tools.Schema.Sql.dll + True - ..\..\packages\Microsoft.SqlServer.DacFx.x64.150.4200.1\lib\net46\Microsoft.Data.Tools.Utilities.dll + ..\..\packages\Microsoft.SqlServer.DacFx.x64.150.4538.1\lib\net46\Microsoft.Data.Tools.Utilities.dll + True - ..\..\packages\Microsoft.SqlServer.DacFx.x64.150.4200.1\lib\net46\Microsoft.SqlServer.Dac.dll + ..\..\packages\Microsoft.SqlServer.DacFx.x64.150.4538.1\lib\net46\Microsoft.SqlServer.Dac.dll + True - ..\..\packages\Microsoft.SqlServer.DacFx.x64.150.4200.1\lib\net46\Microsoft.SqlServer.Dac.Extensions.dll + ..\..\packages\Microsoft.SqlServer.DacFx.x64.150.4538.1\lib\net46\Microsoft.SqlServer.Dac.Extensions.dll + True - ..\..\packages\Microsoft.SqlServer.DacFx.x64.150.4200.1\lib\net46\Microsoft.SqlServer.TransactSql.ScriptDom.dll + ..\..\packages\Microsoft.SqlServer.DacFx.x64.150.4538.1\lib\net46\Microsoft.SqlServer.TransactSql.ScriptDom.dll + True - ..\..\packages\Microsoft.SqlServer.DacFx.x64.150.4200.1\lib\net46\Microsoft.SqlServer.Types.dll + ..\..\packages\Microsoft.SqlServer.DacFx.x64.150.4538.1\lib\net46\Microsoft.SqlServer.Types.dll + True ..\..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll diff --git a/src/SQLCover/test/SQLCover.UnitTests/packages.config b/src/SQLCover/test/SQLCover.UnitTests/packages.config index 1d5ffd5..9670554 100644 --- a/src/SQLCover/test/SQLCover.UnitTests/packages.config +++ b/src/SQLCover/test/SQLCover.UnitTests/packages.config @@ -1,6 +1,6 @@  - +