11# Razor Components Testing Library
22Testing library for Razor Components, that allows you to easily define your component under test and the expected output HTML
33in a ` .razor ` file. It will automatically compare the input with the expected output using the
4- [ XMLDiff] ( https://www.xmlunit.org/ ) library and pretty print error messages using the
5- [ Shouldly] ( https://github.com/shouldly/shouldly ) library.
4+ [ XMLDiff] ( https://www.xmlunit.org/ ) library and pretty print error messages.
65
76The library is currently tied to [ xUnit] ( https://xunit.net/ ) , but it is on the TODO list to make it compatible with all
87.NET Core testing libraries.
@@ -27,7 +26,6 @@ If you have an idea, suggestion, or bug, please add an [issue](issues) or ping m
2726@using Microsoft.JSInterop
2827@using Xunit
2928@using Moq
30- @using Shouldly
3129@using Egil.RazorComponents.Testing
3230```
3331
@@ -201,7 +199,7 @@ If you want to assert directly on the rendered component or change its parameter
201199 // initial assert
202200 var result = RenderResults.Single(x => x.Id == (nameof(DismissTest)));
203201 result.RenderedHtml.ShouldBe(result.Snippets[0]);
204- sut.Visible.ShouldBeTrue( );
202+ Assert.Equal(true, sut.Visible);
205203
206204 // act
207205 isVisible = false;
@@ -210,7 +208,7 @@ If you want to assert directly on the rendered component or change its parameter
210208 // dismiss assert
211209 var dismissResult = RenderResults.Single(x => x.Id == (nameof(DismissTest)));
212210 dismissResult.RenderedHtml.ShouldBe(result.Snippets[1]);
213- sut.Visible.ShouldBeFalse( );
211+ Assert.Equal(false, sut.Visible);
214212 }
215213}
216214<Fact Id=@nameof(DismissTest)>
0 commit comments