diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..a1e1e97
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln merge=binary
+#*.csproj merge=binary
+#*.vbproj merge=binary
+#*.vcxproj merge=binary
+#*.vcproj merge=binary
+#*.dbproj merge=binary
+#*.fsproj merge=binary
+#*.lsproj merge=binary
+#*.wixproj merge=binary
+#*.modelproj merge=binary
+#*.sqlproj merge=binary
+#*.wwaproj merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg binary
+#*.png binary
+#*.gif binary
+
+###############################################################################
+# diff behavior for common document formats
+#
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the
+# entries below.
+###############################################################################
+#*.doc diff=astextplain
+#*.DOC diff=astextplain
+#*.docx diff=astextplain
+#*.DOCX diff=astextplain
+#*.dot diff=astextplain
+#*.DOT diff=astextplain
+#*.pdf diff=astextplain
+#*.PDF diff=astextplain
+#*.rtf diff=astextplain
+#*.RTF diff=astextplain
\ No newline at end of file
diff --git a/.github/workflows/enforce-license-compliance.yml b/.github/workflows/enforce-license-compliance.yml
new file mode 100644
index 0000000..86be741
--- /dev/null
+++ b/.github/workflows/enforce-license-compliance.yml
@@ -0,0 +1,14 @@
+name: Enforce License Compliance
+
+on:
+ pull_request:
+ branches: [main, master]
+
+jobs:
+ enforce-license-compliance:
+ runs-on: ubuntu-latest
+ steps:
+ - name: 'Enforce License Compliance'
+ uses: getsentry/action-enforce-license-compliance@57ba820387a1a9315a46115ee276b2968da51f3d # main
+ with:
+ fossa_api_key: ${{ secrets.FOSSA_API_KEY }}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..b374695
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,255 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# Coverage Report
+MyProject_coverage.xml
\ No newline at end of file
diff --git a/.nuget/packages.config b/.nuget/packages.config
deleted file mode 100644
index 48b51f4..0000000
--- a/.nuget/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/CodeCoveProject.sln b/CodeCoveProject.sln
deleted file mode 100644
index a96755c..0000000
--- a/CodeCoveProject.sln
+++ /dev/null
@@ -1,33 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyUnitTests", "MyUnitTests\MyUnitTests.csproj", "{C96E6E0B-F789-4EEA-916D-6296164A0507}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestTargetProject", "UnitTestTargetProject\UnitTestTargetProject.csproj", "{0232DEEE-0DD3-484B-9075-AFA40779981E}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{2BACFF44-39E4-4C3E-93E8-E1CCBEB1C9B1}"
- ProjectSection(SolutionItems) = preProject
- .nuget\packages.config = .nuget\packages.config
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {C96E6E0B-F789-4EEA-916D-6296164A0507}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {C96E6E0B-F789-4EEA-916D-6296164A0507}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {C96E6E0B-F789-4EEA-916D-6296164A0507}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C96E6E0B-F789-4EEA-916D-6296164A0507}.Release|Any CPU.Build.0 = Release|Any CPU
- {0232DEEE-0DD3-484B-9075-AFA40779981E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {0232DEEE-0DD3-484B-9075-AFA40779981E}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {0232DEEE-0DD3-484B-9075-AFA40779981E}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {0232DEEE-0DD3-484B-9075-AFA40779981E}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/CodecovProject.sln b/CodecovProject.sln
new file mode 100644
index 0000000..c638553
--- /dev/null
+++ b/CodecovProject.sln
@@ -0,0 +1,28 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26403.7
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestTargetProject", "UnitTestTargetProject\UnitTestTargetProject.csproj", "{7D76BF3A-0BD2-446B-980F-79E41F80486D}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyUnitTests", "MyUnitTests\MyUnitTests.csproj", "{81BE4757-282A-47AA-B2C6-B203E327E967}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {7D76BF3A-0BD2-446B-980F-79E41F80486D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7D76BF3A-0BD2-446B-980F-79E41F80486D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7D76BF3A-0BD2-446B-980F-79E41F80486D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7D76BF3A-0BD2-446B-980F-79E41F80486D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {81BE4757-282A-47AA-B2C6-B203E327E967}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {81BE4757-282A-47AA-B2C6-B203E327E967}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {81BE4757-282A-47AA-B2C6-B203E327E967}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {81BE4757-282A-47AA-B2C6-B203E327E967}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..3076469
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017 Codecov and Contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/MyProject_coverage.xml b/MyProject_coverage.xml
deleted file mode 100644
index e69de29..0000000
diff --git a/MyUnitTests/MyTargetClassTests.cs b/MyUnitTests/MyTargetClassTests.cs
index da7928f..b9f0601 100644
--- a/MyUnitTests/MyTargetClassTests.cs
+++ b/MyUnitTests/MyTargetClassTests.cs
@@ -1,28 +1,42 @@
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using UnitTestTargetProject;
+using UnitTestTargetProject;
+using Xunit;
namespace MyUnitTests
{
- [TestClass]
public class MyTargetClassTests
{
- [TestMethod]
+ [Fact]
public void VerifySummation()
{
- int intFirstNumber = 15, intsecondNumber = 10;
- MyTargetClass objTargetClass = new MyTargetClass();
- int intResult = objTargetClass.AddNumbers(intFirstNumber, intsecondNumber);
- Assert.AreEqual(15 + 10, intResult, "Summation method is not written well.");
+ const int intFirstNumber = 15;
+ const int intsecondNumber = 10;
+ var objTargetClass = new MyTargetClass();
+ var intResult = objTargetClass.AddNumbers(intFirstNumber, intsecondNumber);
+ Assert.Equal(15 + 10, intResult);
}
- [TestMethod]
+ [Fact]
public void VerifySubtraction()
{
- int intFirstNumber = 15, intsecondNumber = 10;
- MyTargetClass objTargetClass = new MyTargetClass();
- int intResult = objTargetClass.SubractNumbers(intFirstNumber, intsecondNumber);
- Assert.AreEqual(15 - 10, intResult, "Subtraction method is not written well.");
+ const int intFirstNumber = 15;
+ const int intsecondNumber = 10;
+ var objTargetClass = new MyTargetClass();
+ var intResult = objTargetClass.SubractNumbers(intFirstNumber, intsecondNumber);
+ Assert.Equal(15 - 10, intResult);
+ }
+
+ [Fact]
+ public void VerifyDivision()
+ {
+ const int intFirstNumber = 15;
+ const int intsecondNumber = 10;
+ var objTargetClass = new MyTargetClass();
+
+ // in this though there seems to be some data loss.
+ var intResult = objTargetClass.DivideNumbers(intFirstNumber, intsecondNumber);
+
+ // ensure this is always a int.
+ Assert.Equal((int)(15 / 10), intResult);
}
}
}
diff --git a/MyUnitTests/MyUnitTests.csproj b/MyUnitTests/MyUnitTests.csproj
index fb4c3ef..287c916 100644
--- a/MyUnitTests/MyUnitTests.csproj
+++ b/MyUnitTests/MyUnitTests.csproj
@@ -1,21 +1,16 @@
-
+
+
Debug
AnyCPU
- {C96E6E0B-F789-4EEA-916D-6296164A0507}
+ {81BE4757-282A-47AA-B2C6-B203E327E967}
Library
Properties
MyUnitTests
MyUnitTests
- v4.5
+ v4.5.2
512
- {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 10.0
- $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
- $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
- False
- UnitTest
true
@@ -36,54 +31,38 @@
+
+
+
+
+
+
+
+
+ ..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll
+
+
+ ..\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll
+
+
+ ..\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll
+
+
+ ..\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll
+
-
-
-
-
-
-
-
-
-
-
-
-
- {0232deee-0dd3-484b-9075-afa40779981e}
+ {7d76bf3a-0bd2-446b-980f-79e41f80486d}
UnitTestTargetProject
-
-
-
-
- False
-
-
- False
-
-
- False
-
-
- False
-
-
-
-
-
+
+
+
-
\ No newline at end of file
diff --git a/MyUnitTests/MyUnitTests.csproj.user b/MyUnitTests/MyUnitTests.csproj.user
deleted file mode 100644
index a4a6cdf..0000000
--- a/MyUnitTests/MyUnitTests.csproj.user
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
- ProjectFiles
-
-
\ No newline at end of file
diff --git a/MyUnitTests/Properties/AssemblyInfo.cs b/MyUnitTests/Properties/AssemblyInfo.cs
index cb9322d..6b24707 100644
--- a/MyUnitTests/Properties/AssemblyInfo.cs
+++ b/MyUnitTests/Properties/AssemblyInfo.cs
@@ -2,34 +2,34 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MyUnitTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MyUnitTests")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
+[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("0524ffdd-c825-4fe6-b1be-9427d3a50e92")]
+[assembly: Guid("81be4757-282a-47aa-b2c6-b203e327e967")]
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
diff --git a/MyUnitTests/packages.config b/MyUnitTests/packages.config
new file mode 100644
index 0000000..92944f3
--- /dev/null
+++ b/MyUnitTests/packages.config
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..29f8b4e
--- /dev/null
+++ b/README.md
@@ -0,0 +1,150 @@
+# [Codecov](https://codecov.io) C# Example
+
+[](https://codecov.io/gh/codecov/example-csharp)
+[](https://ci.appveyor.com/project/stevepeak/example-csharp/branch/master)
+[](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-csharp?ref=badge_shield)
+
+## Guide
+### AppVeyor Setup
+Add to your `appveyor.yml` file.
+```yml
+image: Visual Studio 2015
+
+before_build:
+- nuget restore
+- choco install opencover.portable
+- choco install codecov
+
+build:
+ project: CodecovProject.sln
+ verbosity: minimal
+
+test_script:
+- OpenCover.Console.exe -register:user -target:"%xunit20%\xunit.console.x86.exe" -targetargs:".\MyUnitTests\bin\Debug\MyUnitTests.dll -noshadow" -filter:"+[UnitTestTargetProject*]* -[MyUnitTests*]*" -output:".\MyProject_coverage.xml"
+- codecov -f "MyProject_coverage.xml
+```
+### Producing Coverage Reports
+Coverage is generated using [OpenCover](https://github.com/OpenCover/opencover). You can obtain it from [NuGet](https://www.nuget.org/packages/opencover) or [Chocolatey](https://chocolatey.org/packages/opencover.portable). If we run the following command in PowerShell to install OpenCover via Chocolatey,
+
+```powershell
+choco install opencover.portable
+```
+
+the OpenCover commandline will become available.
+
+Generation of coverage report is slighly different depending on the .NET platform of your test projects.
+
+#### .NET Framework project
+
+##### xUnit
+
+First install the xUnit console runner via [Nuget](https://www.nuget.org/packages/xunit.runner.console/2.3.0-beta1-build3642) or [Chocolatey](https://chocolatey.org/packages/XUnit). If we run the following in PowerShell to install xUnit via Chocolatey
+
+```powershell
+choco install xunit
+```
+
+and execute the following in your solution's root,
+
+```powershell
+OpenCover.Console.exe -register:user -target:"xunit.console.x86.exe" -targetargs:".\MyUnitTests\bin\Debug\MyUnitTests.dll -noshadow" -filter:"+[UnitTestTargetProject*]* -[MyUnitTests*]*" -output:".\MyProject_coverage.xml"
+```
+
+Then a coverage report will be generated.
+
+##### MSTest
+
+Execute the following in your solution's root,
+
+```powershell
+OpenCover.Console.exe -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe" -targetargs:"/testcontainer:"".\MyUnitTests\bin\Debug\MyUnitTests.dll" -filter:"+[UnitTestTargetProject*]* -[MyUnitTests*]*" -output:".\MyProject_coverage.xml"
+```
+
+where you may need to change the `-target` flag to point to the correct version of MSTest.
+
+
+#### .NET Core project
+
+If you don't yet have .NET Core SDK installed, install it
+
+```powershell
+choco install dotnetcore-sdk
+```
+
+In case of .NET Core projects, there is no difference between `MSTest` and `xUnit` for coverage report generation.
+
+Make sure all covered projects generate full pdb file (not only test projects), either through `full` in the `.csproj` file or by using a Visual Studio: Project Properties > Build > Advanced > Debugging information. By default, projects created by `dotnet` or by Visual Studio use a portable format for pdb files. Support for portable pdb format [hasn't been released in OpenCover yet](https://github.com/OpenCover/opencover/issues/610). If you fail to set full pdb, the `OpenCover` will print out a message notifying you that it has no results along with common causes.
+
+The .NET Core test assembly can't be run by a `xunit.console.x86.exe`, because that tool works only with .NET Framework assemblies. The tests are run by `dotnet test` (possibly `dotnet xunit` if you [add dotnet-xunit](https://xunit.github.io/docs/getting-started-dotnet-core.html#create-project) CLI tool to your project).
+
+Execute the following command in your solution's root:
+
+```powershell
+OpenCover.Console.exe -register:user -target:"C:/Program Files/dotnet/dotnet.exe" -targetargs:test -filter:"+[UnitTestTargetProject*]* -[MyUnitTests*]*" -output:".\MyProject_coverage.xml" -oldstyle
+```
+
+where `-oldstyle` switch is necessary, because .NET Core uses `System.Private.CoreLib` instead of `mscorlib` and thus `OpenCover` can't use `mscorlib` for code instrumentation. You may also need to change the location of `dotnet.exe` to depending on the installed location.
+
+### Bash
+In bash run the following to upload the report
+
+```bash
+curl -s https://codecov.io/bash > codecov
+chmod +x codecov
+./codecov -f "MyProject_coverage.xml" -t
+```
+
+### Continous Integration
+
+The previous examples assumed local development. More commonly, you'll use a CI service like [AppVeyor](https://www.appveyor.com/) or [TeamCity](https://www.jetbrains.com/teamcity/). For TeamCity builds please see the [documentation](https://github.com/codecov/codecov-exe#teamcity). For AppVeyor builds using xUnit, your yaml file would look something like
+
+#### Codecov-exe using Chocolatey
+
+```yaml
+image: Visual Studio 2015
+
+before_build:
+- nuget restore
+- choco install opencover.portable
+- choco install codecov
+
+build:
+ project: CodecovProject.sln
+ verbosity: minimal
+
+test_script:
+- OpenCover.Console.exe -register:user -target:"%xunit20%\xunit.console.x86.exe" -targetargs:".\MyUnitTests\bin\Debug\MyUnitTests.dll -noshadow" -filter:"+[UnitTestTargetProject*]* -[MyUnitTests*]*" -output:".\MyProject_coverage.xml"
+- codecov -f "MyProject_coverage.xml"
+```
+
+#### Codecov-exe using NuGet
+
+Using this method you can cache your packages.config file.
+
+```yaml
+image: Visual Studio 2015
+
+before_build:
+- nuget restore
+
+build:
+ project: CodecovProject.sln
+ verbosity: minimal
+
+test_script:
+- .\packages\\OpenCover.Console.exe -register:user -target:"%xunit20%\xunit.console.x86.exe" -targetargs:".\MyUnitTests\bin\Debug\MyUnitTests.dll -noshadow" -filter:"+[UnitTestTargetProject*]* -[MyUnitTests*]*" -output:".\MyProject_coverage.xml"
+- .\packages\\codecov.exe -f "MyProject_coverage.xml"
+```
+
+## Caveats
+### Private Repo
+Repository tokens are required for (a) all private repos, (b) public repos not using Travis-CI, CircleCI, GitHub Actions, or AppVeyor. Find your repository token at Codecov and provide via appending `-t ` to you where you upload reports e.g. `.\codecov -f "MyProject_coverage.xml" -t `
+
+## Links
+- [Community Boards](https://community.codecov.io)
+- [Support](https://codecov.io/support)
+- [Documentation](https://docs.codecov.io)
+
+
+## License
+[](https://app.fossa.com/projects/git%2Bgithub.com%2Fcodecov%2Fexample-csharp?ref=badge_large)
\ No newline at end of file
diff --git a/RunTests.bat b/RunTests.bat
deleted file mode 100644
index 15c2bf6..0000000
--- a/RunTests.bat
+++ /dev/null
@@ -1,2 +0,0 @@
-.\packages\OpenCover.4.6.166\tools\OpenCover.Console.exe -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe" -targetargs:"/noresults /noisolation /testcontainer:"".\MyUnitTests\bin\Debug\MyUnitTests.dll" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -output:.\MyProject_coverage.xml
-pause
\ No newline at end of file
diff --git a/UnitTestTargetProject/MyTargetClass.cs b/UnitTestTargetProject/MyTargetClass.cs
index b6e64b1..3fe79f8 100644
--- a/UnitTestTargetProject/MyTargetClass.cs
+++ b/UnitTestTargetProject/MyTargetClass.cs
@@ -1,10 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace UnitTestTargetProject
+namespace UnitTestTargetProject
{
public class MyTargetClass
{
@@ -12,13 +6,15 @@ public int AddNumbers(int pintFirstNumber, int pintSecondNumber)
{
return pintFirstNumber + pintSecondNumber;
}
+
public int SubractNumbers(int pintFirstNumber, int pintSecondNumber)
{
return pintFirstNumber - pintSecondNumber;
}
+
public int DivideNumbers(int pintFirstNumber, int pintSecondNumber)
{
return pintFirstNumber / pintSecondNumber;
}
}
-}
+}
\ No newline at end of file
diff --git a/UnitTestTargetProject/Properties/AssemblyInfo.cs b/UnitTestTargetProject/Properties/AssemblyInfo.cs
index d8d0721..d369261 100644
--- a/UnitTestTargetProject/Properties/AssemblyInfo.cs
+++ b/UnitTestTargetProject/Properties/AssemblyInfo.cs
@@ -2,34 +2,34 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
+// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UnitTestTargetProject")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnitTestTargetProject")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
+[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("1a5f0e65-8311-456e-85cc-c33d2d63b696")]
+[assembly: Guid("7d76bf3a-0bd2-446b-980f-79e41f80486d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
-// Minor Version
+// Minor Version
// Build Number
// Revision
//
-// You can specify all the values or you can default the Build and Revision Numbers
+// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
diff --git a/UnitTestTargetProject/UnitTestTargetProject.csproj b/UnitTestTargetProject/UnitTestTargetProject.csproj
index 88c9f7f..5bc570c 100644
--- a/UnitTestTargetProject/UnitTestTargetProject.csproj
+++ b/UnitTestTargetProject/UnitTestTargetProject.csproj
@@ -1,15 +1,15 @@
-
+
Debug
AnyCPU
- {0232DEEE-0DD3-484B-9075-AFA40779981E}
+ {7D76BF3A-0BD2-446B-980F-79E41F80486D}
Library
Properties
UnitTestTargetProject
UnitTestTargetProject
- v4.5
+ v4.5.2
512
@@ -36,6 +36,7 @@
+
@@ -43,11 +44,4 @@
-
\ No newline at end of file
diff --git a/appveyor.yml b/appveyor.yml
index ffcafd8..ed65b9a 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -1,11 +1,14 @@
-version: 1.0.{build}
+image: Visual Studio 2015
+
before_build:
- - nuget restore
+- nuget restore
+- choco install opencover.portable
+- choco install codecov
+
build:
- project: CodeCoveProject.sln
+ project: CodecovProject.sln
verbosity: minimal
-after_test:
- - packages\OpenCover.4.6.166\tools\OpenCover.Console.exe -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe" -targetargs:"/noresults /noisolation /testcontainer:"".\MyUnitTests\bin\Debug\MyUnitTests.dll" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -output:.\MyProject_coverage.xml
- - "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%"
- - pip install codecov
- - codecov -f "MyProject_coverage.xml"
+
+test_script:
+- OpenCover.Console.exe -register:user -target:"%xunit20%\xunit.console.x86.exe" -targetargs:".\MyUnitTests\bin\Debug\MyUnitTests.dll -noshadow" -filter:"+[UnitTestTargetProject*]* -[MyUnitTests*]*" -output:".\MyProject_coverage.xml"
+- codecov -f "MyProject_coverage.xml"
diff --git a/readme.md b/readme.md
deleted file mode 100644
index 696dcd6..0000000
--- a/readme.md
+++ /dev/null
@@ -1,107 +0,0 @@
-Codecov C# Example
-==================
-
-| [https://codecov.io][1] | [@codecov][2] | [hello@codecov.io][3] |
-| ----------------------- | ------------- | --------------------- |
-
-## Installation
-
-You need to add the [OpenCover][5] nuget package to your Visual Studio solution which is used to generate code coverage analysis:
-
-```
-PM> Install-Package OpenCover
-```
-
-Secondly, you need to either write a PowerShell script (if you intend to generate code coverage and upload the result interactively) or you need to add a few entries in you CI config file (if you intend to let your CI generate the coverage).
-
-
-## Generate the coverage file
-
-Let's assume your C# solution has the following folder structure:
-
-- C:\_build\MyProject\ --> this is your solution's root folder. For instance, this is where you have saved your visual studio solution (.sln) file.
-- C:\_build\MyProject\packages\ --> this is where all nuget packages are downloaded
-- C:\_build\MyProject\MyProject Unit Tests\ --> this is where your C# unit testing project is located (.csproj)
-
-To generate code coverage analysis, execute the following comment from a command prompt in your solution's root:
-
-```PowerShell
-.\packages\OpenCover.4.6.166\tools\OpenCover.Console.exe -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe" -targetargs:"/noresults /noisolation /testcontainer:"".\MyProject Unit Tests\bin\Debug\MyProject.UnitTests.dll" -filter:"+[MyProject]* -[MyProject]MyProject.Properties.*" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -output:.\MyProject_coverage.xml
-```
-
-This command makes a few assumptions which you will most likely have to adjust to meet your needs:
-
-1. Use Visual Studio 2013
-2. Use OpenCover v4.6.166, which is the latest version as of this writing, to generate code coverage. Of course you will need to adjust the path to the OpenCover package when new versions are available.
-3. Unit tests are compiled in a DLL called .\MyProject Unit Tests\bin\Debug\MyProject.UnitTests.dll (replace 'Debug' with 'Release if you compile in 'Release' mode).
-4. Code coverage will include all classes, methods and properties under the [MyProject] namespace except [MyProject]MyProject.Properties. These properties, typically, include your project version number, compiler options, etc. and therefore should be excluded from the code coverage report.
-4. Any class decorated with the 'ExcludeFromCodeCoverage' attribute is automatically excluded from the coverage analysis.
-5. Code coverage analysis is written to a XML file called MyProject_coverage.xml
-
-Now that you have generated your code coverage analysis, you must download Codecov's "upload script" and use it to upload your code coverage file to CodeCov.
-
-
-##PowerShell script
-
-The PowerShell script contains two lines: one to download Codecov's script and the second one to upload your coverage file to Codecov.io
-
-```PowerShell
-(New-Object System.Net.WebClient).DownloadFile("https://codecov.io/bash", ".\CodecovUploader.sh")
-.\CodecovUploader.sh -f "MyProject_coverage.xml -t -X gcov
-```
-
-Of course, you need to replace the `` with your private Codecov upload token.
-
-TIP: for added convenience, you can paste the command from the 'Generate the Coverage file' at the top of this PowerShell script in order to create one convenient script that will both generate the coverage file and upload it to Codecov.io
-
-
-## Continuous Integration
-
-If you use a CI, such as AppVeyor for example, you need to modify the 'after_test' section of your .yml to instruct your CI to generate the coverage file, download Codecov's uploader and finally to upload your coverage file to codecov.io. Here's what the 'after_test' section should look like:
-
-``` YAML
-after_test:
- - .\packages\OpenCover.4.5.3522\OpenCover.Console.exe -register:user -target:"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe" -targetargs:"/noresults /noisolation /testcontainer:"".\MyProject Unit Tests\bin\Debug\MyProject.UnitTests.dll" -filter:"+[MyProject]* -[MyProject]MyProject.Properties.*" -excludebyattribute:*.ExcludeFromCodeCoverage* -hideskipped:All -output:.\MyProject_coverage.xml
- - "SET PATH=C:\\Python34;C:\\Python34\\Scripts;%PATH%"
- - pip install codecov
- - codecov -f "MyProject_coverage.xml"
-```
-
-We recently incorporated codecov.io into [DotNetAnalyzers/StyleCopAnalyzers](https://github.com/DotNetAnalyzers/StyleCopAnalyzers). Based on this experience, I recommend the following changes to the documentation.
-
-### Combine test and code coverage stages
-
-The steps to do this are elusive, but relatively straightforward when you see them.
-
-1. Add the `-returntargetcode` argument to OpenCover.Console
-1. Change the `after_test` section to `test_script`
-
-:thought_balloon: It might make sense to make a note that the code coverage gathering process may be run as a separate build step for users who are unable to or do not wish to run their complete automated testing through OpenCover. Users will want to integrate Codecov *either* in their `test_script` section *or* in their `after_test` section, but not both.
-
-### Include information for XUnit users
-
-Users working with XUnit will need to modify their OpenCover call as follows:
-
-1. The `-target` argument becomes the following:
-
- ```
- -target:"%xunit20%\xunit.console.x86.exe"
- ```
-
-1. The `-targetargs` argument becomes the following (you may want to replace our target assembly path with the one in your original sample; I wasn't familiar enough with the escape sequences for spaces to do it myself):
-
- ```
- -targetargs:"C:\projects\stylecopanalyzers\StyleCop.Analyzers\StyleCop.Analyzers.Test\bin\Debug\StyleCop.Analyzers.Test.dll -noshadow -appveyor"
- ```
-
-
-### Sample project
-
-- [DotNetAnalyzers/StyleCopAnalyzers](https://github.com/DotNetAnalyzers/StyleCopAnalyzers)
-
-
-[1]: https://codecov.io/
-[2]: https://twitter.com/codecov
-[3]: mailto:hello@codecov.io
-[4]: https://github.com/codecov/codecov-bash
-[5]: https://www.nuget.org/packages/OpenCover/