File tree Expand file tree Collapse file tree 6 files changed +34
-5
lines changed
src/bunit.template/template Expand file tree Collapse file tree 6 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -191,6 +191,14 @@ jobs:
191191 dotnet restore ${{ github.workspace }}/TemplateTestXunit --source https://api.nuget.org/v3/index.json --source ${{ env.NUGET_DIRECTORY }}
192192 dotnet test ${{ github.workspace }}/TemplateTestXunit
193193
194+ - name : ✔ Verify xUnit.v3 template
195+ run : |
196+ dotnet new bunit --framework xunitv3 --no-restore -o ${{ github.workspace }}/TemplateTestXunitv3
197+ echo '<?xml version="1.0" encoding="utf-8"?><Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"></Project>' >> ${{ github.workspace }}/TemplateTestXunitv3/Directory.Build.props
198+ echo '<Project><PropertyGroup><ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally></PropertyGroup></Project>' >> ${{ github.workspace }}/TemplateTestXunitv3/Directory.Packages.props
199+ dotnet restore ${{ github.workspace }}/TemplateTestXunitv3 --source https://api.nuget.org/v3/index.json --source ${{ env.NUGET_DIRECTORY }}
200+ dotnet test ${{ github.workspace }}/TemplateTestXunitv3
201+
194202 - name : ✔ Verify NUnit template
195203 run : |
196204 dotnet new bunit --framework nunit --no-restore -o ${{ github.workspace }}/TemplateTestNunit
Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ All notable changes to **bUnit** will be documented in this file. The project ad
66
77## [ Unreleased]
88
9+ ### Added
10+
11+ - Added support for xunit v3 in the bunit.template. By [ @linkdotnet ] ( https://github.com/linkdotnet ) .
12+
913## [ 1.37.7] - 2024-12-13
1014
1115### Added
Original file line number Diff line number Diff line change 5858 "description" : " xUnit unit testing framework" ,
5959 "displayName" : " xUnit"
6060 },
61+ {
62+ "choice" : " xunitv3" ,
63+ "description" : " xUnit v3 unit testing framework" ,
64+ "displayName" : " xUnit v3"
65+ },
6166 {
6267 "choice" : " mstest" ,
6368 "description" : " MSTest unit testing framework" ,
7378 "type" : " computed" ,
7479 "value" : " UnitTestFramework == \" xunit\" "
7580 },
81+ "testFramework_xunitv3" : {
82+ "type" : " computed" ,
83+ "value" : " UnitTestFramework == \" xunitv3\" "
84+ },
7685 "testFramework_mstest" : {
7786 "type" : " computed" ,
7887 "value" : " UnitTestFramework == \" mstest\" "
Original file line number Diff line number Diff line change 3232 </PackageReference >
3333 </ItemGroup >
3434
35+ <ItemGroup Condition =" '$(testFramework_xunitv3)' == 'true'" >
36+ <PackageReference Include =" xunit.v3" Version =" 1.0.0" />
37+ <PackageReference Include =" xunit.runner.visualstudio" Version =" 3.0.0" >
38+ <PrivateAssets >all</PrivateAssets >
39+ <IncludeAssets >runtime; build; native; contentfiles; analyzers</IncludeAssets >
40+ </PackageReference >
41+ </ItemGroup >
42+
3543 <ItemGroup Condition =" '$(testFramework_nunit)' == 'true'" >
3644 <PackageReference Include =" NUnit" Version =" 4.2.2" />
3745 <PackageReference Include =" NUnit3TestAdapter" Version =" 4.6.0" />
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ namespace Company.BlazorTests1;
44/// These tests are written entirely in C#.
55/// Learn more at https://bunit.dev/docs/getting-started/writing-tests.html#creating-basic-tests-in-cs-files
66/// </summary>
7- #if ( testFramework_xunit )
7+ #if ( testFramework_xunit ) || ( testFramework_xunitv3 )
88public class CounterCSharpTests : TestContext
99#elif ( testFramework_nunit )
1010public class CounterCSharpTests : BunitTestContext
@@ -29,7 +29,7 @@ public void CounterStartsAtZero()
2929 cut . Find ( "p" ) . MarkupMatches ( "<p>Current count: 0</p>" ) ;
3030 }
3131
32- #if ( testFramework_xunit )
32+ #if ( testFramework_xunit ) || ( testFramework_xunitv3 )
3333 [ Fact ]
3434#elif ( testFramework_nunit )
3535 [ Test ]
Original file line number Diff line number Diff line change 1- @* #if (testFramework_xunit)*@
1+ @* #if (testFramework_xunit) || (testFramework_xunitv3) *@
22@inherits TestContext
33@* #elif (testFramework_nunit)*@
44@inherits BunitTestContext
@@ -12,7 +12,7 @@ These tests are written entirely in razor and C# syntax.
1212Learn more at https://bunit.dev/docs/getting-started/writing-tests.html#creating-basic-tests-in-razor-files
1313
1414@code {
15- @* #if (testFramework_xunit)*@
15+ @* #if (testFramework_xunit) || testFramework_xunitv3 *@
1616 [Fact ]
1717@* #elif (testFramework_nunit)*@
1818 [Test ]
@@ -27,7 +27,7 @@ Learn more at https://bunit.dev/docs/getting-started/writing-tests.html#creating
2727 // Assert that content of the paragraph shows counter at zero
2828 cut .Find (" p" ).MarkupMatches (@< p > Current count : 0 < / p > );
2929 }
30- @* #if (testFramework_xunit)*@
30+ @* #if (testFramework_xunit) || (testFramework_xunitv3) *@
3131 [Fact ]
3232@* #elif (testFramework_nunit)*@
3333 [Test ]
You can’t perform that action at this time.
0 commit comments