public async Task Get_SecurePageWorksForAlice(string email, string password) { // Arrange var client = await _factory.CreateAuthenticatedClientAsync(email, password); // Act HttpResponseMessage response = await client.GetAsync("/Home/Secure"); // Assert var document = await HtmlHelpers.GetDocumentAsync(response); Assert.Equal("THIS-IS-MY-SECRET-ONLY-VISIBLE-TO-LOGGED-IN-USERS", document.QuerySelector("div[class='secret']")?.TextContent); Assert.Equal(email, document.QuerySelector("div[class='user-id']")?.TextContent); }