Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/.force-nuget-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6
21 changes: 14 additions & 7 deletions .github/workflows/CI-CD-Docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,16 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Setting VERSION and BRANCH env
run: |
echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion"
echo "::set-env name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
- name: Update tokens in project files
uses: cschleiden/replace-tokens@v1
with:
Expand All @@ -30,11 +37,11 @@ jobs:
dotnet-version: '3.1.202'
- name: Building library and docs
run: |
dotnet restore
dotnet build src/bunit.core --no-restore -p:version=$VERSION
dotnet build src/bunit.web --no-restore -p:version=$VERSION
dotnet build src/bunit.xunit --no-restore -p:version=$VERSION
dotnet build docs/docs.csproj --no-restore
dotnet restore src
dotnet build src/bunit.core/ --no-restore -p:version=$VERSION
dotnet build src/bunit.web/ --no-restore -p:version=$VERSION
dotnet build src/bunit.xunit/ --no-restore -p:version=$VERSION
dotnet build docs/docs.csproj
- name: Deploy
uses: JamesIves/github-pages-deploy-action@releases/v3
with:
Expand Down
16 changes: 10 additions & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ jobs:
files: '["*.csproj", "**/*.csproj"]'
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.202'
source-url: https://nuget.pkg.github.com/egil/index.json
env:
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
dotnet-version: '3.1.202'
- name: Building library
run: |
dotnet restore src
Expand All @@ -62,5 +59,12 @@ jobs:
dotnet new bunit --no-restore -o ${GITHUB_WORKSPACE}/Test
dotnet restore ${GITHUB_WORKSPACE}/Test/Test.csproj --source ${GITHUB_WORKSPACE}/packages
dotnet test ${GITHUB_WORKSPACE}/Test
- name: Push packages to GitHub Packages
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/'*.nupkg' --skip-duplicate
- name: Push packages to GitHub Package Registry
run: |
for f in ${GITHUB_WORKSPACE}/packages/*.nupkg
do
curl -vX PUT -u "egil:${{ secrets.GITHUB_TOKEN }}" -F package=@$f https://nuget.pkg.github.com/egil/
done
shell: bash
# - name: Push packages to GitHub Package Registry
# run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/'*.nupkg' --skip-duplicate
70 changes: 70 additions & 0 deletions .github/workflows/NUGET-PUSH.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: NUGET-PUSH

on:
push:
branches:
- master
paths:
- '.github/.force-nuget-push'

env:
VERSION: ''
BRANCH: 'master'

jobs:
build:
name: Build and verify library
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- uses: dotnet/nbgv@master
with:
setAllVars: true
- name: Setting VERSION and BRANCH env
run: echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion"
- name: Update tokens in project files
uses: cschleiden/replace-tokens@v1
with:
files: '["*.csproj", "**/*.csproj"]'
- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.202'
- name: Building library
run: |
dotnet restore src
dotnet build src/bunit.core/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
dotnet build src/bunit.web/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
dotnet build src/bunit.xunit/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
dotnet build src/bunit.testassets/ -c Release --no-restore
- name: Running unit tests
run: |
dotnet test src/bunit.core.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
dotnet test src/bunit.web.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
dotnet test src/bunit.xunit.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
- name: Creating library package
run: |
dotnet pack src/bunit.core/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
dotnet pack src/bunit.web/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
dotnet pack src/bunit.xunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
dotnet pack src/bunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
- name: Buidling template package
run: dotnet pack src/bunit.template/ -c Release -o ${GITHUB_WORKSPACE}/packages
- name: Verifying template
run: |
dotnet new --install ${GITHUB_WORKSPACE}/packages/bunit.template.$VERSION.nupkg
dotnet new bunit --no-restore -o ${GITHUB_WORKSPACE}/Test
dotnet restore ${GITHUB_WORKSPACE}/Test/Test.csproj --source ${GITHUB_WORKSPACE}/packages
dotnet test ${GITHUB_WORKSPACE}/Test
- name: Push packages to NuGet
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/'*.nupkg' -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
- name: Push packages to GitHub Package Registry
run: |
for f in ${GITHUB_WORKSPACE}/packages/*.nupkg
do
curl -vX PUT -u "egil:${{ secrets.GITHUB_TOKEN }}" -F package=@$f https://nuget.pkg.github.com/egil/
done
shell: bash
#- name: Push packages to GitHub Package Registry
# run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/'*.nupkg' -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/egil/index.json --skip-duplicate
8 changes: 5 additions & 3 deletions .github/workflows/RELEASE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- edited

env:
VERSION: 0.0.0
VERSION: ''
BRANCH: ''

jobs:
Expand Down Expand Up @@ -61,5 +61,7 @@ jobs:
dotnet new bunit --no-restore -o ${GITHUB_WORKSPACE}/Test
dotnet restore ${GITHUB_WORKSPACE}/Test/Test.csproj --source ${GITHUB_WORKSPACE}/packages
dotnet test ${GITHUB_WORKSPACE}/Test
- name: Push packages to GitHub Packages
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/'*.nupkg' --skip-duplicate
# - name: Push packages to NuGet
# run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/'*.nupkg' -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
# - name: Push packages to GitHub Package Registry
# run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/'*.nupkg' -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/egil/index.json --skip-duplicate
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@ The library's goal is to make it easy to write _comprehensive, stable unit tests

**Go to [bUnit.egilhansen.com](https://bunit.egilhansen.com) to learn more.**

### NuGet downloads

bUnit is available on NuGet in various incarnations. If you are using xUnit as your general purpose testing framework, you can use `bunit`, which includes everything in one package. If you want to use NUnit or MStest, then pick `bunit.core` and `bunit.web`:

| Name | Type | NuGet Download Link |
| ----- | ----- | ---- |
| bUnit | Library, includes core, web, and xUnit | [![Nuget](https://img.shields.io/nuget/dt/bunit?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit/) |
| bUnit.core | Library, only core | [![Nuget](https://img.shields.io/nuget/dt/bunit.core?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.core/) |
| bUnit.web | Library, web and core | [![Nuget](https://img.shields.io/nuget/dt/bunit.web?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.web/) |
| bUnit.xUnit |Library, xUnit and core | [![Nuget](https://img.shields.io/nuget/dt/bunit.xunit?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.xunit/) |
| bUnit.template | Template, which currently creates an xUnit based bUnit test projects only | [![Nuget](https://img.shields.io/nuget/dt/bunit.template?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.template/) |

To get started, head to the documentation on [bUnit.egilhansen.com/docs](https://bunit.egilhansen.com/docs) to learn more.

## Milestones to v1.0.0

These are the current goals that should be reached before v1.0.0 is ready:
Expand All @@ -36,4 +50,4 @@ In the post v1.0.0 to v1.0.x time frame, focus will be on improving performance.

## Contributors

Shout outs and a big thank you [to all the contributors](https://github.com/egil/bunit/graphs/contributors) to the library, both those that raise issues, provide input to issues, and those who send pull requests.
Shout outs and a big thank you [to all the contributors](https://github.com/egil/bunit/graphs/contributors) to the library, both those that raise issues, provide input to issues, and those who send pull requests. Thank you!
14 changes: 13 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ public void CounterShouldIncrementWhenClicked()

**Go to [Documentation](/docs) to learn more.**

### NuGet downloads

bUnit is available on NuGet in various incarnations. If you are using xUnit as your general purpose testing framework, you can use `bunit`, which includes everything in one package. If you want to use NUnit or MStest, then pick `bunit.core` and `bunit.web`:

| Name | Type | NuGet Download Link |
| ----- | ----- | ---- |
| bUnit | Library, includes core, web, and xUnit | [![Nuget](https://img.shields.io/nuget/dt/bunit?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit/) |
| bUnit.core | Library, only core | [![Nuget](https://img.shields.io/nuget/dt/bunit.core?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.core/) |
| bUnit.web | Library, web and core | [![Nuget](https://img.shields.io/nuget/dt/bunit.web?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.web/) |
| bUnit.xUnit |Library, xUnit and core | [![Nuget](https://img.shields.io/nuget/dt/bunit.xunit?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.xunit/) |
| bUnit.template | Template, which currently creates an xUnit based bUnit test projects only | [![Nuget](https://img.shields.io/nuget/dt/bunit.template?logo=nuget&style=flat-square)](https://www.nuget.org/packages/bunit.template/) |

## Milestones to v1.0.0

These are the current goals that should be reached before v1.0.0 is ready:
Expand All @@ -61,4 +73,4 @@ Shout outs and a big thank you [to all the contributors](https://github.com/egil
- Provide feedback and input through [issues](https://github.com/egil/bunit/issues), [Twitter](https://twitter.com/egilhansen) or [bUnit Gitter chat room](https://gitter.im/egil/bunit).
- Help build the library, just pick an issue and submit pull-requests.
- Help write documentation.
- Create blog posts, presentations or video tutorials. If you do, I will be happy to showcase them in the related section on this site.
- Create blog posts, presentations or video tutorials. If you do, I will be happy to showcase them in the related section on this site.
27 changes: 27 additions & 0 deletions docs/templates/bunit/styles/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.navbar-brand {
line-height: 50px;
margin-right: 15px !important;
}
.navbar-brand>img {
display: inline-block;
margin-top: -8px;
margin-right: 5px;
}

.navbar-brand>span {
font-weight: 600;
font-size: 16px;
color: #fff;
}

.body-content {
font-size: 1.6rem;
}

.article {
margin-top: 80px;
}

.sideaffix {
margin-top: 0;
}
2 changes: 1 addition & 1 deletion src/bunit.core/TestContextBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public TestContextBase()
}

/// <inheritdoc/>
public void Dispose()
public virtual void Dispose()
{
// The service provider should dispose of any
// disposable object it has created, when it is disposed.
Expand Down