|
1 | 1 | using Bunit.Extensions; |
| 2 | +using Bunit.TestAssets.RenderModes; |
2 | 3 | using Xunit.Abstractions; |
3 | 4 | using static Bunit.ComponentParameterFactory; |
4 | 5 |
|
@@ -490,12 +491,28 @@ public void Test208() |
490 | 491 | } |
491 | 492 |
|
492 | 493 | #if NET8_0_OR_GREATER |
493 | | - [Fact(DisplayName = "Can render components that have a RenderMode attribute")] |
| 494 | + [Fact(DisplayName = "Can render components that have a RenderMode InteractiveAuto")] |
494 | 495 | public void Test209() |
495 | 496 | { |
496 | | - var cut = RenderComponent<RenderModeServerComponent>(); |
| 497 | + var cut = RenderComponent<InteractiveAutoComponent>(); |
497 | 498 |
|
498 | | - cut.Find("h3").TextContent.ShouldBe("Hello from Server"); |
| 499 | + cut.Find("h1").TextContent.ShouldBe($"Hello world {RenderMode.InteractiveAuto}"); |
| 500 | + } |
| 501 | + |
| 502 | + [Fact(DisplayName = "Can render components that have a RenderMode InteractiveServer")] |
| 503 | + public void Test210() |
| 504 | + { |
| 505 | + var cut = RenderComponent<InteractiveServerComponent>(); |
| 506 | + |
| 507 | + cut.Find("h1").TextContent.ShouldBe($"Hello world {RenderMode.InteractiveServer}"); |
| 508 | + } |
| 509 | + |
| 510 | + [Fact(DisplayName = "Can render components that have a RenderMode InteractiveWebAssembly")] |
| 511 | + public void Test211() |
| 512 | + { |
| 513 | + var cut = RenderComponent<InteractiveWebAssemblyComponent>(); |
| 514 | + |
| 515 | + cut.Find("h1").TextContent.ShouldBe($"Hello world {RenderMode.InteractiveWebAssembly}"); |
499 | 516 | } |
500 | 517 | #endif |
501 | 518 |
|
@@ -632,15 +649,4 @@ protected override async Task OnAfterRenderAsync(bool firstRender) |
632 | 649 | throw new InvalidOperationException(); |
633 | 650 | } |
634 | 651 | } |
635 | | - |
636 | | -#if NET8_0_OR_GREATER |
637 | | - [RenderModeServer] |
638 | | - private sealed class RenderModeServerComponent : ComponentBase |
639 | | - { |
640 | | - protected override void BuildRenderTree(RenderTreeBuilder builder) |
641 | | - { |
642 | | - builder.AddMarkupContent(0, "<h3>Hello from Server</h3>"); |
643 | | - } |
644 | | - } |
645 | | -#endif |
646 | 652 | } |
0 commit comments