We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7072e6d commit 624309bCopy full SHA for 624309b
docs/samples/tests/xunit/CounterTestWithCtx.cs
@@ -0,0 +1,23 @@
1
+using Xunit;
2
+using Bunit;
3
+
4
+namespace Bunit.Docs.Samples
5
+{
6
+ public class CounterTestWithCtx
7
+ {
8
+ [Fact]
9
+ public void CounterShouldIncrementWhenClicked()
10
11
+ // Arrange: render the Counter.razor component
12
+ using var ctx = new TestContext();
13
+ var cut = ctx.RenderComponent<Counter>();
14
15
+ // Act: find and click the <button> element to increment
16
+ // the counter in the <p> element
17
+ cut.Find("button").Click();
18
19
+ // Assert: first find the <p> element, then verify its content
20
+ cut.Find("p").MarkupMatches("<p>Current count: 1</p>");
21
+ }
22
23
+}
0 commit comments