Add a test for #6294

This case was fixed by 2992f8e - this commit just adds a test to verify
the fix.
This commit is contained in:
Ryan Nowak 2017-05-24 16:41:25 -07:00
parent 2992f8e38a
commit c1dd95be2a
3 changed files with 24 additions and 0 deletions

View File

@ -1011,6 +1011,19 @@ Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary`1[AspNetCore._InjectedP
Assert.StartsWith(expected, response.Trim());
}
[Fact]
public async Task Page_WithSection_CanAccessModel()
{
// Arrange
var expected = "Value is 17";
// Act
var response = await Client.GetStringAsync("/Pages/Section");
// Assert
Assert.StartsWith(expected, response.Trim());
}
private async Task AddAntiforgeryHeaders(HttpRequestMessage request)
{
var getResponse = await Client.GetAsync(request.RequestUri);

View File

@ -0,0 +1,10 @@
@page
@{
Layout = "_Layout";
}
@functions {
public int MyValue { get; set; } = 17;
}
@section mysection {
Value is @Model.MyValue
}

View File

@ -0,0 +1 @@
@RenderSection("mysection")