add coverage things

This commit is contained in:
Tommy Parnell
2016-11-08 21:59:33 -05:00
parent 754d7cbff4
commit 1cbd7873e1
9 changed files with 68 additions and 12 deletions

2
.gitignore vendored
View File

@@ -9,7 +9,7 @@
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
tools
# Build results
[Dd]ebug/
[Dd]ebugPublic/

23
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,23 @@
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/bin/Debug/<target-framework>/<project-name.dll>",
"args": [],
"cwd": "${workspaceRoot}",
"externalConsole": false,
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command.pickProcess}"
}
]
}

16
.vscode/tasks.json vendored Normal file
View File

@@ -0,0 +1,16 @@
{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [
""
],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
}
]
}

6
Coverage.ps1 Normal file
View File

@@ -0,0 +1,6 @@
nuget install OpenCover -Version 4.6.519 -OutputDirectory tools
nuget install coveralls.net -Version 0.7.0 -OutputDirectory tools
.\tools\OpenCover.4.6.519\tools\OpenCover.Console.exe -target:"C:\Program Files\dotnet\dotnet.exe" -targetargs:" test "".\src\UriBuilder.Fluent.UnitTests"" -f net461" -register:user -filter:"+[UriBuilder*]* -[*Tests]*" -returntargetcode -output:opencover_results.xml
.\tools\coveralls.net.0.7.0\tools\csmacnz.Coveralls.exe --opencover -i .\opencover_results.xml

View File

@@ -12,6 +12,7 @@ init:
before_build:
- ps: invoke-webrequest https://go.microsoft.com/fwlink/?LinkID=827524 -OutFile core.exe
- ps: .\core.exe /install /quiet /norestart
- ps: .\update-projectjson.ps1
- ps: dotnet restore
build_script:
@@ -20,4 +21,5 @@ build_script:
- ps: dotnet build -c Release .\src\UriBuilder.Fluent.UnitTests
test_script:
- ps: dotnet test -c Release .\src\UriBuilder.Fluent.UnitTests
- ps: dotnet test -c Release .\src\UriBuilder.Fluent.UnitTests
- ps: .\Coverage.ps1

View File

@@ -9,6 +9,7 @@
},
"frameworks": {
"net46": {},
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {

View File

@@ -21,7 +21,7 @@ namespace System
valuesEnum = new string[0];
}
var isfirst = string.IsNullOrWhiteSpace(bld.Query);
var intitialValue = isfirst ? "?" : $"{bld.Query}&";
var intitialValue = isfirst ? "" : $"{bld.Query.TrimStart('?')}&";
var sb = new StringBuilder($"{intitialValue}{key}");
var validValueHit = false;
foreach(var value in valuesEnum)

View File

@@ -6,7 +6,7 @@
},
"frameworks": {
"netstandard1.6": {
"netstandard1.3": {
"imports": "dnxcore50"
}
}

View File

@@ -1,8 +1,16 @@
Get-ChildItem -Path $ENV:APPVEYOR_BUILD_FOLDER -Recurse File -Filter project.json | foreach {
$jsonFile = Get-Content $_.FullName -raw | ConvertFrom-Json
if($jsonFile.version)
{
$jsonFile.version = $ENV:APPVEYOR_BUILD_VERSION
$jsonFile | ConvertTo-Json -Depth 999 | Out-File $_.FullName
}
}
$projectJsonFileLocation = "src/UriBuilder.Fluent/project.json"
$newVersion = $env:APPVEYOR_REPO_TAG_NAME
if($newVersion -eq $null)
{
$newVersion = "1.0.0-${env:APPVEYOR_BUILD_VERSION}"
}
if($newVersion -eq $null)
{
return
}
Write-Host "$projectJsonFileLocation will be update with new version '$newVersion'"
$json = (Get-Content $projectJsonFileLocation -Raw) | ConvertFrom-Json
$json.version = $newVersion
$json | ConvertTo-Json -depth 100 | Out-File $projectJsonFileLocation