Current count: 0
"); } +#if (testFramework_xunit) [Fact] +#elif (testFramework_nunit) + [Test] +#elif (testFramework_mstest) + [TestMethod] +#endif public void ClickingButtonIncrementsCounter() { // Arrange diff --git a/src/bunit.template/template/CounterRazorTests.razor b/src/bunit.template/template/CounterRazorTests.razor index 63ba07dc1..7992eda2d 100644 --- a/src/bunit.template/template/CounterRazorTests.razor +++ b/src/bunit.template/template/CounterRazorTests.razor @@ -1,11 +1,24 @@ +@*#if (testFramework_xunit)*@ @inherits TestContext +@*#elif (testFramework_nunit)*@ +@inherits BunitTestContext +@*#elif (testFramework_mstest)*@ +@attribute [TestClass] +@inherits BunitTestContext +@*#endif*@ These tests are written entirely in razor and C# syntax. Learn more at https://bunit.dev/docs/getting-started/writing-tests.html#creating-basic-tests-in-razor-files @code { - [Fact] +@*#if (testFramework_xunit)*@ + [Fact] +@*#elif (testFramework_nunit)*@ + [Test] +@*#elif (testFramework_mstest)*@ + [TestMethod] +@*#endif*@ public void CounterStartsAtZero() { // Arrange @@ -14,8 +27,13 @@ Learn more at https://bunit.dev/docs/getting-started/writing-tests.html#creating // Assert that content of the paragraph shows counter at zero cut.Find("p").MarkupMatches(@Current count: 0
); } - - [Fact] +@*#if (testFramework_xunit)*@ + [Fact] +@*#elif (testFramework_nunit)*@ + [Test] +@*#elif (testFramework_mstest)*@ + [TestMethod] +@*#endif*@ public void ClickingButtonIncrementsCounter() { // Arrange diff --git a/src/bunit.template/template/_Imports.razor b/src/bunit.template/template/_Imports.razor index 5703c2018..054402d02 100644 --- a/src/bunit.template/template/_Imports.razor +++ b/src/bunit.template/template/_Imports.razor @@ -3,4 +3,10 @@ @using Microsoft.Extensions.DependencyInjection @using Bunit @using Bunit.TestDoubles +@*#if (testFramework_xunit)*@ @using Xunit +@*#elif (testFramework_nunit)*@ +@using NUnit.Framework +@*#elif (testFramework_mstest)*@ +@using Microsoft.VisualStudio.TestTools.UnitTesting +@*#endif*@ diff --git a/src/bunit.web.testcomponents/bunit.web.testcomponents.csproj b/src/bunit.web.testcomponents/bunit.web.testcomponents.csproj index 7055a1fdf..207937c5c 100644 --- a/src/bunit.web.testcomponents/bunit.web.testcomponents.csproj +++ b/src/bunit.web.testcomponents/bunit.web.testcomponents.csproj @@ -24,7 +24,7 @@ NOTE: This package represents experimental features of bUnit that has been superitem
"); + + addChildContent.ShouldThrowitem
"); + + sut.Build() + .ShouldHaveSingleItem() + .ShouldBeParameter