Skip to content

Commit 9bac1ab

Browse files
committed
Docs: re-arranged docs to make samples runnable/testable
1 parent f6cf960 commit 9bac1ab

82 files changed

Lines changed: 236 additions & 58 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/CI-CD-Docs.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,27 @@ jobs:
3030
- uses: actions/setup-dotnet@v1
3131
with:
3232
dotnet-version: '3.1.202'
33-
- name: Building library and docs
33+
- name: Building library
3434
run: |
3535
dotnet restore src
3636
dotnet build src/bunit.core/ --no-restore -p:version=$VERSION
3737
dotnet build src/bunit.web/ --no-restore -p:version=$VERSION
3838
dotnet build src/bunit.xunit/ --no-restore -p:version=$VERSION
39-
dotnet build docs/
40-
dotnet build docs/
39+
- name: Verfiy docs samples
40+
run: |
41+
dotnet test docs/sample/tests/mstest --no-restore
42+
dotnet test docs/sample/tests/nunit --no-restore
43+
dotnet test docs/sample/tests/razor --no-restore
44+
dotnet test docs/sample/tests/xunit --no-restore
45+
- name: Building docs
46+
run: |
47+
dotnet build docs/site/
48+
dotnet build docs/site/
4149
- name: Deploy to GitHub Pages
4250
if: success()
4351
uses: crazy-max/ghaction-github-pages@v2
4452
with:
4553
target_branch: gh-pages
46-
build_dir: docs/_site
54+
build_dir: docs/site/_site
4755
env:
4856
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docs/samples/components/AlertType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Docs.Components
1+
namespace Bunit.Docs.Samples
22
{
33
public enum AlertType
44
{

docs/samples/components/AllKindsOfParams.razor

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,10 @@
55

66
[Parameter]
77
public List<string> Lines { get; set; }
8+
9+
[Parameter]
10+
public EventCallback<MouseEventArgs> OnClick { get; set; }
11+
12+
[Parameter]
13+
public EventCallback OnSomething { get; set; }
814
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
@namespace Docs.Components
1+
@namespace Bunit.Docs.Samples
22
@using Microsoft.AspNetCore.Components.Web
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Razor">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<RazorLangVersion>3.0</RazorLangVersion>
6+
<RootNamespace>Bunit.Docs.Samples</RootNamespace>
7+
</PropertyGroup>
8+
9+
10+
<ItemGroup>
11+
<PackageReference Include="Microsoft.AspNetCore.Components" Version="3.1.4" />
12+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="3.1.4" />
13+
</ItemGroup>
14+
15+
</Project>

docs/samples/tests/mstest/BunitTestContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using Microsoft.AspNetCore.Components;
55
using Microsoft.VisualStudio.TestTools.UnitTesting;
66

7-
namespace Docs.Components.MSTest
7+
namespace Bunit.Docs.Samples
88
{
99
public abstract class BunitTestContext : ITestContext, IDisposable
1010
{

docs/samples/tests/mstest/HelloWorldImplicitContextTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Bunit;
22
using Microsoft.VisualStudio.TestTools.UnitTesting;
33

4-
namespace Docs.Components.MSTest
4+
namespace Bunit.Docs.Samples
55
{
66
[TestClass]
77
public class HelloHelloWorldImplicitContextTest : BunitTestContext

docs/samples/tests/mstest/HelloWorldTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Bunit;
22
using Microsoft.VisualStudio.TestTools.UnitTesting;
33

4-
namespace Docs.Components.MSTest
4+
namespace Bunit.Docs.Samples
55
{
66
[TestClass]
77
public class HelloWorldTest
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Razor">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
5+
<IsPackable>false</IsPackable>
6+
<RootNamespace>Bunit.Docs.Samples</RootNamespace>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
11+
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
12+
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
13+
<PackageReference Include="coverlet.collector" Version="1.2.0" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<ProjectReference Include="../../../../src/bunit.core/bunit.core.csproj" />
18+
<ProjectReference Include="../../../../src/bunit.web/bunit.web.csproj" />
19+
<ProjectReference Include="../../components/bunit.docs.samples.csproj" />
20+
</ItemGroup>
21+
22+
</Project>

docs/samples/tests/nunit/BunitTestContext.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using Microsoft.AspNetCore.Components;
55
using NUnit.Framework;
66

7-
namespace Docs.Components.NUnit
7+
namespace Bunit.Docs.Samples
88
{
99
public abstract class BunitTestContext : ITestContext, IDisposable
1010
{

0 commit comments

Comments
 (0)