|
1 | | -using System; |
2 | | -using Bunit; |
3 | | -using Bunit.TestDoubles; |
4 | | -using Xunit; |
| 1 | +namespace Company.BlazorTests1; |
5 | 2 |
|
6 | | -namespace Company.BlazorTests1 |
| 3 | +/// <summary> |
| 4 | +/// These tests are written entirely in C#. |
| 5 | +/// Learn more at https://bunit.dev/docs/getting-started/writing-tests.html#creating-basic-tests-in-cs-files |
| 6 | +/// </summary> |
| 7 | +public class CounterCSharpTests : TestContext |
7 | 8 | { |
8 | | - /// <summary> |
9 | | - /// These tests are written entirely in C#. |
10 | | - /// Learn more at https://bunit.egilhansen.com/docs/getting-started/ |
11 | | - /// </summary> |
12 | | - public class CounterCSharpTests : TestContext |
13 | | - { |
14 | | - [Fact] |
15 | | - public void CounterStartsAtZero() |
16 | | - { |
17 | | - // Arrange |
18 | | - var cut = RenderComponent<Counter>(); |
| 9 | + [Fact] |
| 10 | + public void CounterStartsAtZero() |
| 11 | + { |
| 12 | + // Arrange |
| 13 | + var cut = RenderComponent<Counter>(); |
19 | 14 |
|
20 | | - // Assert that content of the paragraph shows counter at zero |
21 | | - cut.Find("p").MarkupMatches("<p>Current count: 0</p>"); |
22 | | - } |
| 15 | + // Assert that content of the paragraph shows counter at zero |
| 16 | + cut.Find("p").MarkupMatches("<p>Current count: 0</p>"); |
| 17 | + } |
23 | 18 |
|
24 | | - [Fact] |
25 | | - public void ClickingButtonIncrementsCounter() |
26 | | - { |
27 | | - // Arrange |
28 | | - var cut = RenderComponent<Counter>(); |
| 19 | + [Fact] |
| 20 | + public void ClickingButtonIncrementsCounter() |
| 21 | + { |
| 22 | + // Arrange |
| 23 | + var cut = RenderComponent<Counter>(); |
29 | 24 |
|
30 | | - // Act - click button to increment counter |
31 | | - cut.Find("button").Click(); |
| 25 | + // Act - click button to increment counter |
| 26 | + cut.Find("button").Click(); |
32 | 27 |
|
33 | | - // Assert that the counter was incremented |
34 | | - cut.Find("p").MarkupMatches("<p>Current count: 1</p>"); |
35 | | - } |
36 | | - } |
| 28 | + // Assert that the counter was incremented |
| 29 | + cut.Find("p").MarkupMatches("<p>Current count: 1</p>"); |
| 30 | + } |
37 | 31 | } |
0 commit comments