AddFakePersistentComponentState() is not available. #1533
-
I am attempting to test a page that injects the AuthenticationStateProvider. I tried following the instructions for Faking persistent component state but when I attempt to add [Fact]
public void Home_With_ServerTestService_Should_AValidPage_Test()
{
//Arrange
const string expected =
"""
<h1>Hello, world!</h1>
Welcome to your new app.
<p>Hello from Blazor Server!</p>
""";
Services.AddSingleton<IBlazorTestService, ServerTestService>();
var fakeState = AddFakePersistentComponentState();
//Act
var cut = RenderComponent<Home>();
//Assert
cut.MarkupMatches(expected);
} |
Beta Was this translation helpful? Give feedback.
Answered by
linkdotnet
Sep 3, 2024
Replies: 1 comment 5 replies
-
Hey @mpaulosky Can you post the concrete exception, including the stack trace? |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That should probably be
this.AddFakePersistentComponentState()
and seems to be wrong in the docs.