Skip to content

Conversation

SteveSandersonMS
Copy link
Member

While creating E2E tests for the new IComponentContext, I tried to do prerendering with an app mounted on a non-root pathbase, and found this bug.

@SteveSandersonMS SteveSandersonMS added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates area-blazor Includes: Blazor, Razor Components labels Mar 29, 2019
// Arrange
var circuitFactory = new TestCircuitFactory();
var circuitPrerenderer = new CircuitPrerenderer(circuitFactory);
var httpContext = new Mock<HttpContext>();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strongly dislike mocking (any set of tests based around mocks tends to degrade into a write-only copy-paste fest), so I'm sad to be using it here. But other than handling this entirely as E2E tests, it's probably the only viable way to cover our interaction with HttpContext.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to mention. You don't have to mock. You can simply do new DefaultHttpContext() and save yourself some pain. Sorry I missed that.

@javiercn
Copy link
Member

@SteveSandersonMS SteveSandersonMS merged commit 49b074d into master Mar 29, 2019
@SteveSandersonMS SteveSandersonMS deleted the stevesa/fix-prerendering-baseuri branch March 29, 2019 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-blazor Includes: Blazor, Razor Components area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants