I am trying to test a blazor component. In the logic of the component i set some text in an subdiv somewhere inside the component. Now i want to verify that the text is set properly:
<div><div></div><div> @Title</div></div>At the moment i use the following code to instantiate the component. Now i want to verify that "title" is actually used as the title.
[Fact]public void TestSomething(){ // act var cut = RenderComponent<MyComponent>(parameters => parameters .Add(p => p.Title, "title") );}Now how would i verify that "title" is actually rendered in the right place?
I found two approaches: either i build an system to generate unique ids throughout my whole project or i just set static ids. Both are either way to much work or end in duplicate ids. Are there any better approaches to test something like this?