Get tests working with `core.autocrlf=false`
- #1514 - refactor `RazorCompilationService` to allow a test subclass that normalizes Razor file line endings - add `TestRazorCompilationService` to `RazorPageExecutionInstrumentationWebSite` - adjust line endings to match in `RazorPageExecutionInstrumentationTest` - add `ignoreLineEndingDifferences: true` to `Assert.Equal()` calls - responses on Windows can have a mix of line endings - `git config` setting affects line endings in .cshtml (and baseline) files - however MVC and Razor mix `Environment.NewLine`s into HTTP responses - update `PrecompilationTest` to split response regardless of line endings - update `ResourceFile` to normalize all source file streams to LF only - ensures consistent checksums and line mappings - change `MvcRazorHostTest` to expect new line mappings - recreate baseline files to expect new checksums and literal line endings - use verbatim strings in affected tests - careful use of `Environment.NewLine` in expectations is now just noise nits: - add doc comments in `RazorCompilationService` - correct `TagHelpersTest` name to match containing file - avoid incorrect `using` removal when `GENERATE_BASELINES` is not defined - remove unnecessary `ResourceFile` normalization of output files
This commit is contained in:
parent
09838fb45a
commit
9c63d1d842
|
|
@ -22,9 +22,18 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
|
||||||
private readonly IMvcRazorHost _razorHost;
|
private readonly IMvcRazorHost _razorHost;
|
||||||
private readonly IFileProvider _fileProvider;
|
private readonly IFileProvider _fileProvider;
|
||||||
|
|
||||||
public RazorCompilationService(ICompilationService compilationService,
|
/// <summary>
|
||||||
IMvcRazorHost razorHost,
|
/// Instantiates a new instance of the <see cref="RazorCompilationService"/> class.
|
||||||
IOptions<RazorViewEngineOptions> viewEngineOptions)
|
/// </summary>
|
||||||
|
/// <param name="compilationService">The <see cref="ICompilationService"/> to compile generated code.</param>
|
||||||
|
/// <param name="razorHost">The <see cref="IMvcRazorHost"/> to generate code from Razor files.</param>
|
||||||
|
/// <param name="viewEngineOptions">
|
||||||
|
/// The <see cref="IFileProvider"/> to read Razor files referenced in error messages.
|
||||||
|
/// </param>
|
||||||
|
public RazorCompilationService(
|
||||||
|
ICompilationService compilationService,
|
||||||
|
IMvcRazorHost razorHost,
|
||||||
|
IOptions<RazorViewEngineOptions> viewEngineOptions)
|
||||||
{
|
{
|
||||||
_compilationService = compilationService;
|
_compilationService = compilationService;
|
||||||
_razorHost = razorHost;
|
_razorHost = razorHost;
|
||||||
|
|
@ -37,7 +46,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
|
||||||
GeneratorResults results;
|
GeneratorResults results;
|
||||||
using (var inputStream = file.FileInfo.CreateReadStream())
|
using (var inputStream = file.FileInfo.CreateReadStream())
|
||||||
{
|
{
|
||||||
results = _razorHost.GenerateCode(file.RelativePath, inputStream);
|
results = GenerateCode(file.RelativePath, inputStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!results.Success)
|
if (!results.Success)
|
||||||
|
|
@ -48,6 +57,21 @@ namespace Microsoft.AspNet.Mvc.Razor.Compilation
|
||||||
return _compilationService.Compile(file, results.GeneratedCode);
|
return _compilationService.Compile(file, results.GeneratedCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Generate code for the Razor file at <paramref name="relativePath"/> with content
|
||||||
|
/// <paramref name="inputStream"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="relativePath">
|
||||||
|
/// The path of the Razor file relative to the root of the application. Used to generate line pragmas and
|
||||||
|
/// calculate the class name of the generated type.
|
||||||
|
/// </param>
|
||||||
|
/// <param name="inputStream">A <see cref="Stream"/> that contains the Razor content.</param>
|
||||||
|
/// <returns>A <see cref="GeneratorResults"/> instance containing results of code generation.</returns>
|
||||||
|
protected virtual GeneratorResults GenerateCode(string relativePath, Stream inputStream)
|
||||||
|
{
|
||||||
|
return _razorHost.GenerateCode(relativePath, inputStream);
|
||||||
|
}
|
||||||
|
|
||||||
// Internal for unit testing
|
// Internal for unit testing
|
||||||
internal CompilationResult GetCompilationFailedResult(RelativeFileInfo file, IEnumerable<RazorError> errors)
|
internal CompilationResult GetCompilationFailedResult(RelativeFileInfo file, IEnumerable<RazorError> errors)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
var expected = "<body><h2>Activation Test</h2>" +
|
var expected = "<body><h2>Activation Test</h2>" +
|
||||||
Environment.NewLine +
|
Environment.NewLine +
|
||||||
"<div>FakeFakeFake</div>" +
|
"<div>FakeFakeFake</div>" +
|
||||||
Environment.NewLine +
|
Environment.NewLine +
|
||||||
"<span>" +
|
"<span>" +
|
||||||
"<input id=\"foo\" name=\"foo\" type=\"hidden\" value=\"test content\" />" +
|
"<input id=\"foo\" name=\"foo\" type=\"hidden\" value=\"test content\" />" +
|
||||||
"</span>" +
|
"</span>" +
|
||||||
|
|
@ -168,7 +168,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
var body = await client.GetStringAsync("http://localhost/View/UseTagHelper");
|
var body = await client.GetStringAsync("http://localhost/View/UseTagHelper");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,7 +106,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,9 +258,11 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
Name = "John <b>Smith</b>"
|
Name = "John <b>Smith</b>"
|
||||||
});
|
});
|
||||||
|
|
||||||
var expectedBody = string.Format(@"<script type=""text/javascript"">" + Environment.NewLine +
|
var expectedBody = string.Format(
|
||||||
@" var json = {0};" + Environment.NewLine +
|
@"<script type=""text/javascript"">
|
||||||
@"</script>", json);
|
var json = {0};
|
||||||
|
</script>",
|
||||||
|
json);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await client.GetAsync("https://localhost/Home/JsonHelperInView");
|
var response = await client.GetAsync("https://localhost/Home/JsonHelperInView");
|
||||||
|
|
@ -270,7 +272,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
Assert.Equal("text/html", response.Content.Headers.ContentType.MediaType);
|
Assert.Equal("text/html", response.Content.Headers.ContentType.MediaType);
|
||||||
|
|
||||||
var actualBody = await response.Content.ReadAsStringAsync();
|
var actualBody = await response.Content.ReadAsStringAsync();
|
||||||
Assert.Equal(expectedBody, actualBody);
|
Assert.Equal(expectedBody, actualBody, ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -286,9 +288,11 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
Name = "John <b>Smith</b>"
|
Name = "John <b>Smith</b>"
|
||||||
}, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() });
|
}, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() });
|
||||||
|
|
||||||
var expectedBody = string.Format(@"<script type=""text/javascript"">" + Environment.NewLine +
|
var expectedBody = string.Format(
|
||||||
@" var json = {0};" + Environment.NewLine +
|
@"<script type=""text/javascript"">
|
||||||
@"</script>", json);
|
var json = {0};
|
||||||
|
</script>",
|
||||||
|
json);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await client.GetAsync("https://localhost/Home/JsonHelperWithSettingsInView");
|
var response = await client.GetAsync("https://localhost/Home/JsonHelperWithSettingsInView");
|
||||||
|
|
@ -298,7 +302,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
Assert.Equal("text/html", response.Content.Headers.ContentType.MediaType);
|
Assert.Equal("text/html", response.Content.Headers.ContentType.MediaType);
|
||||||
|
|
||||||
var actualBody = await response.Content.ReadAsStringAsync();
|
var actualBody = await response.Content.ReadAsStringAsync();
|
||||||
Assert.Equal(expectedBody, actualBody);
|
Assert.Equal(expectedBody, actualBody, ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<object[]> HtmlHelperLinkGenerationData
|
public static IEnumerable<object[]> HtmlHelperLinkGenerationData
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||||
Assert.Equal(ExpectedOutput, content);
|
Assert.Equal(ExpectedOutput, content, ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -28,7 +28,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
|
|
||||||
This method is only defined in DNX451";
|
This method is only defined in DNX451";
|
||||||
#elif DNXCORE50
|
#elif DNXCORE50
|
||||||
var expected =
|
var expected =
|
||||||
@"This method is running from DNXCORE50
|
@"This method is running from DNXCORE50
|
||||||
|
|
||||||
This method is only defined in DNXCORE50";
|
This method is only defined in DNXCORE50";
|
||||||
|
|
@ -40,7 +40,7 @@ This method is only defined in DNXCORE50";
|
||||||
var body = await client.GetStringAsync("http://localhost/ViewsConsumingCompilationOptions/");
|
var body = await client.GetStringAsync("http://localhost/ViewsConsumingCompilationOptions/");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -169,17 +169,29 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData("ContactInfoUsingV3Format", "text/vcard; version=v3.0; charset=utf-8", "BEGIN:VCARD#FN:John Williams#END:VCARD#")]
|
[InlineData(
|
||||||
[InlineData("ContactInfoUsingV4Format", "text/vcard; version=v4.0; charset=utf-8", "BEGIN:VCARD#FN:John Williams#GENDER:M#END:VCARD#")]
|
"ContactInfoUsingV3Format",
|
||||||
|
"text/vcard; version=v3.0; charset=utf-8",
|
||||||
|
@"BEGIN:VCARD
|
||||||
|
FN:John Williams
|
||||||
|
END:VCARD
|
||||||
|
")]
|
||||||
|
[InlineData(
|
||||||
|
"ContactInfoUsingV4Format",
|
||||||
|
"text/vcard; version=v4.0; charset=utf-8",
|
||||||
|
@"BEGIN:VCARD
|
||||||
|
FN:John Williams
|
||||||
|
GENDER:M
|
||||||
|
END:VCARD
|
||||||
|
")]
|
||||||
public async Task ProducesAttribute_WithMediaTypeHavingParameters_IsCaseInsensitiveMatch(
|
public async Task ProducesAttribute_WithMediaTypeHavingParameters_IsCaseInsensitiveMatch(
|
||||||
string action,
|
string action,
|
||||||
string expectedMediaType,
|
string expectedMediaType,
|
||||||
string expectedResponseBody)
|
string expectedResponseBody)
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var server = TestHelper.CreateServer(_app, SiteName, _configureServices);
|
var server = TestHelper.CreateServer(_app, SiteName, _configureServices);
|
||||||
var client = server.CreateClient();
|
var client = server.CreateClient();
|
||||||
expectedResponseBody = expectedResponseBody.Replace("#", Environment.NewLine);
|
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var response = await client.GetAsync("http://localhost/ProducesWithMediaTypeParameters/" + action);
|
var response = await client.GetAsync("http://localhost/ProducesWithMediaTypeParameters/" + action);
|
||||||
|
|
@ -192,7 +204,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
Assert.Equal(expectedMediaType, contentType.ToString());
|
Assert.Equal(expectedMediaType, contentType.ToString());
|
||||||
|
|
||||||
var actualResponseBody = await response.Content.ReadAsStringAsync();
|
var actualResponseBody = await response.Content.ReadAsStringAsync();
|
||||||
Assert.Equal(expectedResponseBody, actualResponseBody);
|
Assert.Equal(expectedResponseBody, actualResponseBody, ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
||||||
|
|
@ -74,14 +74,17 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
waitService.WaitForServer();
|
waitService.WaitForServer();
|
||||||
|
|
||||||
// Assert - 4
|
// Assert - 4
|
||||||
Assert.Equal(@"After flush inside partial
|
Assert.Equal(
|
||||||
|
@"After flush inside partial
|
||||||
<form action=""/FlushPoint/PageWithoutLayout"" method=""post""><input id=""Name1"" name=""Name1"" type=""text"" value="""" />",
|
<form action=""/FlushPoint/PageWithoutLayout"" method=""post""><input id=""Name1"" name=""Name1"" type=""text"" value="""" />",
|
||||||
GetTrimmedString(stream));
|
GetTrimmedString(stream),
|
||||||
|
ignoreLineEndingDifferences: true);
|
||||||
waitService.WaitForServer();
|
waitService.WaitForServer();
|
||||||
|
|
||||||
// Assert - 5
|
// Assert - 5
|
||||||
Assert.Equal(@"<input id=""Name2"" name=""Name2"" type=""text"" value="""" /></form>",
|
Assert.Equal(
|
||||||
GetTrimmedString(stream));
|
@"<input id=""Name2"" name=""Name2"" type=""text"" value="""" /></form>",
|
||||||
|
GetTrimmedString(stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
|
@ -102,28 +105,32 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
var stream = await client.GetStreamAsync("http://localhost/FlushPoint/" + action);
|
var stream = await client.GetStreamAsync("http://localhost/FlushPoint/" + action);
|
||||||
|
|
||||||
// Assert - 1
|
// Assert - 1
|
||||||
Assert.Equal(string.Join(Environment.NewLine,
|
Assert.Equal(
|
||||||
"<title>" + title + "</title>",
|
$@"<title>{ title }</title>
|
||||||
"",
|
|
||||||
"RenderBody content"), GetTrimmedString(stream));
|
RenderBody content",
|
||||||
|
GetTrimmedString(stream),
|
||||||
|
ignoreLineEndingDifferences: true);
|
||||||
waitService.WaitForServer();
|
waitService.WaitForServer();
|
||||||
|
|
||||||
// Assert - 2
|
// Assert - 2
|
||||||
Assert.Equal(string.Join(
|
Assert.Equal(
|
||||||
Environment.NewLine,
|
@"partial-content
|
||||||
"partial-content",
|
|
||||||
"",
|
Value from TaskReturningString
|
||||||
"Value from TaskReturningString",
|
<p>section-content</p>",
|
||||||
"<p>section-content</p>"), GetTrimmedString(stream));
|
GetTrimmedString(stream),
|
||||||
|
ignoreLineEndingDifferences: true);
|
||||||
waitService.WaitForServer();
|
waitService.WaitForServer();
|
||||||
|
|
||||||
// Assert - 3
|
// Assert - 3
|
||||||
Assert.Equal(string.Join(
|
Assert.Equal(
|
||||||
Environment.NewLine,
|
@"component-content
|
||||||
"component-content",
|
<span>Content that takes time to produce</span>
|
||||||
" <span>Content that takes time to produce</span>",
|
|
||||||
"",
|
More content from layout",
|
||||||
"More content from layout"), GetTrimmedString(stream));
|
GetTrimmedString(stream),
|
||||||
|
ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -143,10 +150,12 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
var stream = await client.GetStreamAsync("http://localhost/FlushPoint/PageWithNestedLayout");
|
var stream = await client.GetStreamAsync("http://localhost/FlushPoint/PageWithNestedLayout");
|
||||||
|
|
||||||
// Assert - 1
|
// Assert - 1
|
||||||
Assert.Equal(@"Inside Nested Layout
|
Assert.Equal(
|
||||||
|
@"Inside Nested Layout
|
||||||
|
|
||||||
<title>Nested Page With Layout</title>",
|
<title>Nested Page With Layout</title>",
|
||||||
GetTrimmedString(stream));
|
GetTrimmedString(stream),
|
||||||
|
ignoreLineEndingDifferences: true);
|
||||||
waitService.WaitForServer();
|
waitService.WaitForServer();
|
||||||
|
|
||||||
// Assert - 2
|
// Assert - 2
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent.Trim(), responseContent);
|
Assert.Equal(expectedContent.Trim(), responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -89,7 +89,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
expectedContent = string.Format(expectedContent, forgeryToken);
|
expectedContent = string.Format(expectedContent, forgeryToken);
|
||||||
Assert.Equal(expectedContent.Trim(), responseContent);
|
Assert.Equal(expectedContent.Trim(), responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -133,7 +133,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent.Trim(), responseContent);
|
Assert.Equal(expectedContent.Trim(), responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -145,7 +145,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
expectedContent = string.Format(expectedContent, forgeryToken);
|
expectedContent = string.Format(expectedContent, forgeryToken);
|
||||||
Assert.Equal(expectedContent.Trim(), responseContent);
|
Assert.Equal(expectedContent.Trim(), responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -188,7 +188,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
expectedContent = string.Format(expectedContent, forgeryToken);
|
expectedContent = string.Format(expectedContent, forgeryToken);
|
||||||
Assert.Equal(expectedContent.Trim(), responseContent);
|
Assert.Equal(expectedContent.Trim(), responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -223,8 +223,8 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile1, expected1, response1.Trim());
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile1, expected1, response1.Trim());
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expected1, response1.Trim());
|
Assert.Equal(expected1, response1.Trim(), ignoreLineEndingDifferences: true);
|
||||||
Assert.Equal(expected1, response2.Trim());
|
Assert.Equal(expected1, response2.Trim(), ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Act - 2
|
// Act - 2
|
||||||
|
|
@ -237,8 +237,8 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile2, expected2, response3.Trim());
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile2, expected2, response3.Trim());
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expected2, response3.Trim());
|
Assert.Equal(expected2, response3.Trim(), ignoreLineEndingDifferences: true);
|
||||||
Assert.Equal(expected2, response4.Trim());
|
Assert.Equal(expected2, response4.Trim(), ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Act - 3
|
// Act - 3
|
||||||
|
|
@ -254,8 +254,8 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile3, expected3, response5.Trim());
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile3, expected3, response5.Trim());
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expected3, response5.Trim());
|
Assert.Equal(expected3, response5.Trim(), ignoreLineEndingDifferences: true);
|
||||||
Assert.Equal(expected3, response6.Trim());
|
Assert.Equal(expected3, response6.Trim(), ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -413,7 +413,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
var expected1 =
|
var expected1 =
|
||||||
@"Category: Books
|
@"Category: Books
|
||||||
Products: Book1, Book2 (1)";
|
Products: Book1, Book2 (1)";
|
||||||
Assert.Equal(expected1, response1.Trim());
|
Assert.Equal(expected1, response1.Trim(), ignoreLineEndingDifferences: true);
|
||||||
|
|
||||||
// Act - 2
|
// Act - 2
|
||||||
var response2 = await client.GetStringAsync("/categories/Electronics?correlationId=2");
|
var response2 = await client.GetStringAsync("/categories/Electronics?correlationId=2");
|
||||||
|
|
@ -422,7 +422,7 @@ Products: Book1, Book2 (1)";
|
||||||
var expected2 =
|
var expected2 =
|
||||||
@"Category: Electronics
|
@"Category: Electronics
|
||||||
Products: Book1, Book2 (1)";
|
Products: Book1, Book2 (1)";
|
||||||
Assert.Equal(expected2, response2.Trim());
|
Assert.Equal(expected2, response2.Trim(), ignoreLineEndingDifferences: true);
|
||||||
|
|
||||||
// Act - 3
|
// Act - 3
|
||||||
// Trigger an expiration
|
// Trigger an expiration
|
||||||
|
|
@ -435,7 +435,7 @@ Products: Book1, Book2 (1)";
|
||||||
var expected3 =
|
var expected3 =
|
||||||
@"Category: Electronics
|
@"Category: Electronics
|
||||||
Products: Laptops (3)";
|
Products: Laptops (3)";
|
||||||
Assert.Equal(expected3, response4.Trim());
|
Assert.Equal(expected3, response4.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -503,7 +503,7 @@ Products: Laptops (3)";
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
expectedContent = string.Format(expectedContent, forgeryTokens);
|
expectedContent = string.Format(expectedContent, forgeryTokens);
|
||||||
Assert.Equal(expectedContent.Trim(), responseContent);
|
Assert.Equal(expectedContent.Trim(), responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ False";
|
||||||
var body = await client.GetStringAsync("http://localhost/HtmlHelperOptions/HtmlHelperOptionsDefaultsInView");
|
var body = await client.GetStringAsync("http://localhost/HtmlHelperOptions/HtmlHelperOptionsDefaultsInView");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -83,7 +83,7 @@ True";
|
||||||
var body = await client.GetStringAsync("http://localhost/HtmlHelperOptions/OverrideAppWideDefaultsInView");
|
var body = await client.GetStringAsync("http://localhost/HtmlHelperOptions/OverrideAppWideDefaultsInView");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ mypartial
|
||||||
var body = await client.GetStringAsync("http://localhost/");
|
var body = await client.GetStringAsync("http://localhost/");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1406,7 +1406,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1442,7 +1442,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1478,7 +1478,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1629,7 +1629,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1653,7 +1653,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1696,7 +1696,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ using System.Net;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNet.Builder;
|
||||||
using Microsoft.AspNet.Mvc.Razor;
|
|
||||||
using Microsoft.AspNet.Mvc.Razor.Precompilation;
|
using Microsoft.AspNet.Mvc.Razor.Precompilation;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
using Microsoft.Framework.Runtime;
|
using Microsoft.Framework.Runtime;
|
||||||
|
|
@ -236,7 +235,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var assemblyNamePrefix = GetAssemblyNamePrefix();
|
var assemblyNamePrefix = GetAssemblyNamePrefix();
|
||||||
var expected =
|
var expected =
|
||||||
@"<root data-root=""true""><input class=""form-control"" type=""number"" data-val=""true""" +
|
@"<root data-root=""true""><input class=""form-control"" type=""number"" data-val=""true""" +
|
||||||
@" data-val-range=""The field Age must be between 10 and 100."" data-val-range-max=""100"" "+
|
@" data-val-range=""The field Age must be between 10 and 100."" data-val-range-max=""100"" "+
|
||||||
@"data-val-range-min=""10"" data-val-required=""The Age field is required."" " +
|
@"data-val-range-min=""10"" data-val-required=""The Age field is required."" " +
|
||||||
|
|
@ -248,7 +247,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
var response = await client.GetStringAsync("http://localhost/TagHelpers/Add");
|
var response = await client.GetStringAsync("http://localhost/TagHelpers/Add");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var responseLines = response.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
var responseLines = response.Split(new[] { "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
Assert.StartsWith(assemblyNamePrefix, responseLines[0]);
|
Assert.StartsWith(assemblyNamePrefix, responseLines[0]);
|
||||||
Assert.Equal(expected, responseLines[1]);
|
Assert.Equal(expected, responseLines[1]);
|
||||||
}
|
}
|
||||||
|
|
@ -266,7 +265,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
var response = await client.GetStringAsync("http://localhost/TagHelpers/Remove");
|
var response = await client.GetStringAsync("http://localhost/TagHelpers/Remove");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
var responseLines = response.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
var responseLines = response.Split(new[] { "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
Assert.StartsWith(assemblyNamePrefix, responseLines[0]);
|
Assert.StartsWith(assemblyNamePrefix, responseLines[0]);
|
||||||
Assert.Equal(expected, responseLines[1]);
|
Assert.Equal(expected, responseLines[1]);
|
||||||
}
|
}
|
||||||
|
|
@ -291,10 +290,10 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
{
|
{
|
||||||
public ParsedResponse(string responseContent)
|
public ParsedResponse(string responseContent)
|
||||||
{
|
{
|
||||||
var results = responseContent.Split(new[] { Environment.NewLine },
|
var results = responseContent
|
||||||
StringSplitOptions.RemoveEmptyEntries)
|
.Split(new[] { "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries)
|
||||||
.Select(s => s.Trim())
|
.Select(s => s.Trim())
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
Assert.True(results[0].StartsWith("Layout:"));
|
Assert.True(results[0].StartsWith("Layout:"));
|
||||||
Layout = results[0].Substring("Layout:".Length);
|
Layout = results[0].Substring("Layout:".Length);
|
||||||
|
|
|
||||||
|
|
@ -21,72 +21,70 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var expected = string.Join(Environment.NewLine,
|
var expected = @"<div>
|
||||||
@"<div>",
|
2147483647
|
||||||
@"2147483647",
|
|
||||||
"",
|
viewstart-content
|
||||||
@"viewstart-content",
|
<p class=""Hello world"">
|
||||||
@"<p class=""Hello world"">",
|
page-content
|
||||||
@"page-content",
|
</p>
|
||||||
@"</p>",
|
</div>";
|
||||||
@"</div>");
|
|
||||||
|
|
||||||
var expectedLineMappings = new[]
|
var expectedLineMappings = new[]
|
||||||
{
|
{
|
||||||
Tuple.Create(93, 2, true),
|
Tuple.Create(90, 1, true),
|
||||||
Tuple.Create(96, 16, false),
|
Tuple.Create(92, 16, false),
|
||||||
Tuple.Create(112, 2, true),
|
Tuple.Create(108, 1, true),
|
||||||
Tuple.Create(0, 2, true),
|
Tuple.Create(0, 2, true),
|
||||||
Tuple.Create(2, 8, true),
|
Tuple.Create(2, 8, true),
|
||||||
Tuple.Create(10, 16, false),
|
Tuple.Create(10, 16, false),
|
||||||
Tuple.Create(26, 1, true),
|
Tuple.Create(26, 1, true),
|
||||||
Tuple.Create(27, 21, true),
|
Tuple.Create(27, 19, true),
|
||||||
Tuple.Create(0, 7, true),
|
Tuple.Create(0, 6, true),
|
||||||
Tuple.Create(8, 12, false),
|
Tuple.Create(7, 12, false),
|
||||||
Tuple.Create(20, 2, true),
|
Tuple.Create(19, 1, true),
|
||||||
Tuple.Create(23, 12, false),
|
Tuple.Create(21, 12, false),
|
||||||
Tuple.Create(35, 8, true),
|
Tuple.Create(33, 7, true),
|
||||||
};
|
};
|
||||||
|
|
||||||
yield return new object[] { "FullPath", expected, expectedLineMappings };
|
yield return new object[] { "FullPath", expected, expectedLineMappings };
|
||||||
yield return new object[] { "ViewDiscoveryPath", expected, expectedLineMappings };
|
yield return new object[] { "ViewDiscoveryPath", expected, expectedLineMappings };
|
||||||
|
|
||||||
var expected2 = string.Join(Environment.NewLine,
|
var expected2 = @"<div>
|
||||||
"<div>",
|
2147483647
|
||||||
"2147483647",
|
|
||||||
"",
|
viewstart-content
|
||||||
"viewstart-content",
|
view-with-partial-content
|
||||||
"view-with-partial-content",
|
|
||||||
"",
|
<p class=""class"">partial-content</p>
|
||||||
@"<p class=""class"">partial-content</p>",
|
|
||||||
"",
|
<p class=""class"">partial-content</p>
|
||||||
@"<p class=""class"">partial-content</p>",
|
</div>";
|
||||||
"</div>");
|
|
||||||
var expectedLineMappings2 = new[]
|
var expectedLineMappings2 = new[]
|
||||||
{
|
{
|
||||||
Tuple.Create(93, 2, true),
|
Tuple.Create(90, 1, true),
|
||||||
Tuple.Create(96, 16, false),
|
Tuple.Create(92, 16, false),
|
||||||
Tuple.Create(112, 2, true),
|
Tuple.Create(108, 1, true),
|
||||||
Tuple.Create(0, 27, true),
|
Tuple.Create(0, 26, true),
|
||||||
Tuple.Create(28, 39, false),
|
Tuple.Create(27, 39, false),
|
||||||
// Html.PartialAsync()
|
// Html.PartialAsync()
|
||||||
Tuple.Create(29, 4, true),
|
Tuple.Create(27, 3, true),
|
||||||
Tuple.Create(33, 8, true),
|
Tuple.Create(30, 8, true),
|
||||||
Tuple.Create(41, 4, false),
|
Tuple.Create(38, 4, false),
|
||||||
Tuple.Create(45, 1, true),
|
Tuple.Create(42, 1, true),
|
||||||
Tuple.Create(46, 20, true),
|
Tuple.Create(43, 20, true),
|
||||||
Tuple.Create(67, 2, true),
|
Tuple.Create(66, 1, true),
|
||||||
// Html.RenderPartial()
|
// Html.RenderPartial()
|
||||||
Tuple.Create(29, 4, true),
|
Tuple.Create(27, 3, true),
|
||||||
Tuple.Create(33, 8, true),
|
Tuple.Create(30, 8, true),
|
||||||
Tuple.Create(41, 4, false),
|
Tuple.Create(38, 4, false),
|
||||||
Tuple.Create(45, 1, true),
|
Tuple.Create(42, 1, true),
|
||||||
Tuple.Create(46, 20, true),
|
Tuple.Create(43, 20, true),
|
||||||
Tuple.Create(0, 7, true),
|
Tuple.Create(0, 6, true),
|
||||||
Tuple.Create(8, 12, false),
|
Tuple.Create(7, 12, false),
|
||||||
Tuple.Create(20, 2, true),
|
Tuple.Create(19, 1, true),
|
||||||
Tuple.Create(23, 12, false),
|
Tuple.Create(21, 12, false),
|
||||||
Tuple.Create(35, 8, true)
|
Tuple.Create(33, 7, true)
|
||||||
};
|
};
|
||||||
yield return new object[] { "ViewWithPartial", expected2, expectedLineMappings2 };
|
yield return new object[] { "ViewWithPartial", expected2, expectedLineMappings2 };
|
||||||
}
|
}
|
||||||
|
|
@ -97,7 +95,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
public async Task ViewsAreServedWithoutInstrumentationByDefault(
|
public async Task ViewsAreServedWithoutInstrumentationByDefault(
|
||||||
string actionName,
|
string actionName,
|
||||||
string expected,
|
string expected,
|
||||||
IEnumerable<Tuple<int, int, bool>> expectedLineMappings)
|
IEnumerable<Tuple<int, int, bool>> ignored)
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var context = new TestPageExecutionContext();
|
var context = new TestPageExecutionContext();
|
||||||
|
|
@ -112,7 +110,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
var body = await client.GetStringAsync("http://localhost/Home/" + actionName);
|
var body = await client.GetStringAsync("http://localhost/Home/" + actionName);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
Assert.Empty(context.Values);
|
Assert.Empty(context.Values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,7 +135,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
var body = await client.GetStringAsync("http://localhost/Home/" + actionName);
|
var body = await client.GetStringAsync("http://localhost/Home/" + actionName);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
Assert.Equal(expectedLineMappings, context.Values);
|
Assert.Equal(expectedLineMappings, context.Values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,7 +159,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
var body = await client.GetStringAsync("http://localhost/Home/" + actionName);
|
var body = await client.GetStringAsync("http://localhost/Home/" + actionName);
|
||||||
|
|
||||||
// Assert - 1
|
// Assert - 1
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
Assert.Empty(context.Values);
|
Assert.Empty(context.Values);
|
||||||
|
|
||||||
// Arrange - 2
|
// Arrange - 2
|
||||||
|
|
@ -171,7 +169,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
body = await client.GetStringAsync("http://localhost/Home/" + actionName);
|
body = await client.GetStringAsync("http://localhost/Home/" + actionName);
|
||||||
|
|
||||||
// Assert - 2
|
// Assert - 2
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
Assert.Equal(expectedLineMappings, context.Values);
|
Assert.Equal(expectedLineMappings, context.Values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -181,19 +179,19 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
// Arrange - 1
|
// Arrange - 1
|
||||||
var expectedLineMappings = new[]
|
var expectedLineMappings = new[]
|
||||||
{
|
{
|
||||||
Tuple.Create(93, 2, true),
|
Tuple.Create(90, 1, true),
|
||||||
Tuple.Create(96, 16, false),
|
Tuple.Create(92, 16, false),
|
||||||
Tuple.Create(112, 2, true),
|
Tuple.Create(108, 1, true),
|
||||||
Tuple.Create(0, 2, true),
|
Tuple.Create(0, 2, true),
|
||||||
Tuple.Create(2, 8, true),
|
Tuple.Create(2, 8, true),
|
||||||
Tuple.Create(10, 16, false),
|
Tuple.Create(10, 16, false),
|
||||||
Tuple.Create(26, 1, true),
|
Tuple.Create(26, 1, true),
|
||||||
Tuple.Create(27, 21, true),
|
Tuple.Create(27, 19, true),
|
||||||
Tuple.Create(0, 7, true),
|
Tuple.Create(0, 6, true),
|
||||||
Tuple.Create(8, 12, false),
|
Tuple.Create(7, 12, false),
|
||||||
Tuple.Create(20, 2, true),
|
Tuple.Create(19, 1, true),
|
||||||
Tuple.Create(23, 12, false),
|
Tuple.Create(21, 12, false),
|
||||||
Tuple.Create(35, 8, true),
|
Tuple.Create(33, 7, true),
|
||||||
};
|
};
|
||||||
var context = new TestPageExecutionContext();
|
var context = new TestPageExecutionContext();
|
||||||
var server = TestHelper.CreateServer(_app, SiteName, services =>
|
var server = TestHelper.CreateServer(_app, SiteName, services =>
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ _ViewStart that specifies partial Layout
|
||||||
var body = await client.GetStringAsync(BaseUrl + action);
|
var body = await client.GetStringAsync(BaseUrl + action);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
|
@ -56,7 +56,7 @@ Layout specified in page
|
||||||
var body = await client.GetStringAsync(BaseUrl + actionName);
|
var body = await client.GetStringAsync(BaseUrl + actionName);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
|
@ -75,7 +75,7 @@ Page With Non Partial Layout
|
||||||
var body = await client.GetStringAsync(BaseUrl + actionName);
|
var body = await client.GetStringAsync(BaseUrl + actionName);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
|
|
@ -97,7 +97,7 @@ Non Shared Partial
|
||||||
var body = await client.GetStringAsync(BaseUrl + actionName);
|
var body = await client.GetStringAsync(BaseUrl + actionName);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -47,7 +47,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.AspNet.Mvc.FunctionalTests
|
namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
{
|
{
|
||||||
public class TagHelpersTests
|
public class TagHelpersTest
|
||||||
{
|
{
|
||||||
private const string SiteName = nameof(TagHelpersWebSite);
|
private const string SiteName = nameof(TagHelpersWebSite);
|
||||||
|
|
||||||
|
|
@ -23,7 +23,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
// so they require a reference to the assembly on which the resources are located, in order to
|
// so they require a reference to the assembly on which the resources are located, in order to
|
||||||
// make the tests less verbose, we get a reference to the assembly with the resources and we
|
// make the tests less verbose, we get a reference to the assembly with the resources and we
|
||||||
// use it on all the rest of the tests.
|
// use it on all the rest of the tests.
|
||||||
private static readonly Assembly _resourcesAssembly = typeof(TagHelpersTests).GetTypeInfo().Assembly;
|
private static readonly Assembly _resourcesAssembly = typeof(TagHelpersTest).GetTypeInfo().Assembly;
|
||||||
|
|
||||||
private readonly Action<IApplicationBuilder> _app = new Startup().Configure;
|
private readonly Action<IApplicationBuilder> _app = new Startup().Configure;
|
||||||
private readonly Action<IServiceCollection> _configureServices = new Startup().ConfigureServices;
|
private readonly Action<IServiceCollection> _configureServices = new Startup().ConfigureServices;
|
||||||
|
|
@ -54,7 +54,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -67,45 +67,55 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
"NestedViewImportsTagHelper",
|
"NestedViewImportsTagHelper",
|
||||||
string.Format(
|
@"<root>root-content</root>
|
||||||
"<root>root-content</root>{0}{0}{0}<nested>nested-content</nested>",
|
|
||||||
Environment.NewLine)
|
|
||||||
|
<nested>nested-content</nested>"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ViewWithLayoutAndNestedTagHelper",
|
"ViewWithLayoutAndNestedTagHelper",
|
||||||
string.Format(
|
@"layout:<root>root-content</root>
|
||||||
"layout:<root>root-content</root>{0}{0}{0}<nested>nested-content</nested>",
|
|
||||||
Environment.NewLine)
|
|
||||||
|
<nested>nested-content</nested>"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ViewWithInheritedRemoveTagHelper",
|
"ViewWithInheritedRemoveTagHelper",
|
||||||
string.Format(
|
@"layout:<root>root-content</root>
|
||||||
"layout:<root>root-content</root>{0}{0}{0}page:<root/>{0}<nested>nested-content</nested>",
|
|
||||||
Environment.NewLine)
|
|
||||||
|
page:<root/>
|
||||||
|
<nested>nested-content</nested>"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ViewWithInheritedTagHelperPrefix",
|
"ViewWithInheritedTagHelperPrefix",
|
||||||
string.Format(
|
@"layout:<root>root-content</root>
|
||||||
"layout:<root>root-content</root>{0}{0}{0}page:<root>root-content</root>",
|
|
||||||
Environment.NewLine)
|
|
||||||
|
page:<root>root-content</root>"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ViewWithOverriddenTagHelperPrefix",
|
"ViewWithOverriddenTagHelperPrefix",
|
||||||
string.Format(
|
@"layout:<root>root-content</root>
|
||||||
"layout:<root>root-content</root>{0}{0}{0}{0}page:<root>root-content</root>",
|
|
||||||
Environment.NewLine)
|
|
||||||
|
|
||||||
|
page:<root>root-content</root>"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ViewWithNestedInheritedTagHelperPrefix",
|
"ViewWithNestedInheritedTagHelperPrefix",
|
||||||
string.Format(
|
@"layout:<root>root-content</root>
|
||||||
"layout:<root>root-content</root>{0}{0}{0}page:<root>root-content</root>",
|
|
||||||
Environment.NewLine)
|
|
||||||
|
page:<root>root-content</root>"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ViewWithNestedOverriddenTagHelperPrefix",
|
"ViewWithNestedOverriddenTagHelperPrefix",
|
||||||
string.Format(
|
@"layout:<root>root-content</root>
|
||||||
"layout:<root>root-content</root>{0}{0}{0}{0}page:<root>root-content</root>",
|
|
||||||
Environment.NewLine)
|
|
||||||
|
|
||||||
|
page:<root>root-content</root>"
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -123,7 +133,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
var result = await client.GetStringAsync("http://localhost/Home/" + action);
|
var result = await client.GetStringAsync("http://localhost/Home/" + action);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, result.Trim());
|
Assert.Equal(expected, result.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -146,7 +156,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,7 +190,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -214,7 +224,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_resourcesAssembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,17 +24,15 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
yield return new[]
|
yield return new[]
|
||||||
{
|
{
|
||||||
"ViewWithAsyncComponents",
|
"ViewWithAsyncComponents",
|
||||||
string.Join(Environment.NewLine,
|
@"<test-component>value-from-component value-from-view</test-component>
|
||||||
"<test-component>value-from-component value-from-view</test-component>",
|
ViewWithAsyncComponents InvokeAsync: hello from viewdatacomponent"
|
||||||
"ViewWithAsyncComponents InvokeAsync: hello from viewdatacomponent")
|
|
||||||
};
|
};
|
||||||
|
|
||||||
yield return new[]
|
yield return new[]
|
||||||
{
|
{
|
||||||
"ViewWithSyncComponents",
|
"ViewWithSyncComponents",
|
||||||
string.Join(Environment.NewLine,
|
@"<test-component>value-from-component value-from-view</test-component>
|
||||||
"<test-component>value-from-component value-from-view</test-component>",
|
ViewWithSyncComponents Invoke: hello from viewdatacomponent"
|
||||||
"ViewWithSyncComponents Invoke: hello from viewdatacomponent")
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +48,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
|
||||||
var body = await client.GetStringAsync("http://localhost/Home/" + actionName);
|
var body = await client.GetStringAsync("http://localhost/Home/" + actionName);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
|
||||||
|
|
@ -74,20 +74,19 @@ ViewWithNestedLayout-Content
|
||||||
var body = await client.GetStringAsync("http://localhost/ViewEngine/" + actionName);
|
var body = await client.GetStringAsync("http://localhost/ViewEngine/" + actionName);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task RazorView_ExecutesPartialPagesWithCorrectContext()
|
public async Task RazorView_ExecutesPartialPagesWithCorrectContext()
|
||||||
{
|
{
|
||||||
var expected = string.Join(Environment.NewLine,
|
var expected = @"<partial>98052
|
||||||
"<partial>98052",
|
|
||||||
"",
|
</partial>
|
||||||
"</partial>",
|
<partial2>98052
|
||||||
"<partial2>98052",
|
|
||||||
"",
|
</partial2>
|
||||||
"</partial2>",
|
test-value";
|
||||||
"test-value");
|
|
||||||
var server = TestHelper.CreateServer(_app, SiteName, _configureServices);
|
var server = TestHelper.CreateServer(_app, SiteName, _configureServices);
|
||||||
var client = server.CreateClient();
|
var client = server.CreateClient();
|
||||||
|
|
||||||
|
|
@ -95,7 +94,7 @@ ViewWithNestedLayout-Content
|
||||||
var body = await client.GetStringAsync("http://localhost/ViewEngine/ViewWithPartial");
|
var body = await client.GetStringAsync("http://localhost/ViewEngine/ViewWithPartial");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -129,26 +128,23 @@ component-content";
|
||||||
var body = await client.GetStringAsync("http://localhost/ViewEngine/ViewPassesViewDataToLayout");
|
var body = await client.GetStringAsync("http://localhost/ViewEngine/ViewPassesViewDataToLayout");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<object[]> RazorViewEngine_UsesAllExpandedPathsToLookForViewsData
|
public static IEnumerable<object[]> RazorViewEngine_UsesAllExpandedPathsToLookForViewsData
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var expected1 = string.Join(Environment.NewLine,
|
var expected1 = @"expander-index
|
||||||
"expander-index",
|
gb-partial";
|
||||||
"gb-partial");
|
|
||||||
yield return new[] { "en-GB", expected1 };
|
yield return new[] { "en-GB", expected1 };
|
||||||
|
|
||||||
var expected2 = string.Join(Environment.NewLine,
|
var expected2 = @"fr-index
|
||||||
"fr-index",
|
fr-partial";
|
||||||
"fr-partial");
|
|
||||||
yield return new[] { "fr", expected2 };
|
yield return new[] { "fr", expected2 };
|
||||||
|
|
||||||
var expected3 = string.Join(Environment.NewLine,
|
var expected3 = @"expander-index
|
||||||
"expander-index",
|
expander-partial";
|
||||||
"expander-partial");
|
|
||||||
yield return new[] { "na", expected3 };
|
yield return new[] { "na", expected3 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -169,7 +165,7 @@ component-content";
|
||||||
var body = await client.GetStringAsync("http://localhost/TemplateExpander");
|
var body = await client.GetStringAsync("http://localhost/TemplateExpander");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TheoryData ViewLocationExpanders_PassesInIsPartialToViewLocationExpanderContextData
|
public static TheoryData ViewLocationExpanders_PassesInIsPartialToViewLocationExpanderContextData
|
||||||
|
|
@ -241,10 +237,10 @@ ViewWithNestedLayout-Content
|
||||||
};
|
};
|
||||||
yield return new[]
|
yield return new[]
|
||||||
{
|
{
|
||||||
"PartialWithModel", string.Join(Environment.NewLine,
|
"PartialWithModel",
|
||||||
"my name is judge",
|
@"my name is judge
|
||||||
"<partial>98052",
|
<partial>98052
|
||||||
"</partial>")
|
</partial>"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -261,18 +257,17 @@ ViewWithNestedLayout-Content
|
||||||
var body = await client.GetStringAsync("http://localhost/PartialViewEngine/" + actionName);
|
var body = await client.GetStringAsync("http://localhost/PartialViewEngine/" + actionName);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task LayoutValueIsPassedBetweenNestedViewStarts()
|
public async Task LayoutValueIsPassedBetweenNestedViewStarts()
|
||||||
{
|
{
|
||||||
// Arrange
|
// Arrange
|
||||||
var expected = string.Join(Environment.NewLine,
|
var expected = @"<title>viewstart-value</title>
|
||||||
"<title>viewstart-value</title>",
|
|
||||||
"",
|
~/Views/NestedViewStarts/NestedViewStarts/Layout.cshtml
|
||||||
"~/Views/NestedViewStarts/NestedViewStarts/Layout.cshtml",
|
index-content";
|
||||||
"index-content");
|
|
||||||
var server = TestHelper.CreateServer(_app, SiteName, _configureServices);
|
var server = TestHelper.CreateServer(_app, SiteName, _configureServices);
|
||||||
var client = server.CreateClient();
|
var client = server.CreateClient();
|
||||||
|
|
||||||
|
|
@ -280,7 +275,7 @@ ViewWithNestedLayout-Content
|
||||||
var body = await client.GetStringAsync("http://localhost/NestedViewStarts");
|
var body = await client.GetStringAsync("http://localhost/NestedViewStarts");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IEnumerable<object[]> RazorViewEngine_UsesExpandersForLayoutsData
|
public static IEnumerable<object[]> RazorViewEngine_UsesExpandersForLayoutsData
|
||||||
|
|
@ -320,7 +315,7 @@ View With Layout
|
||||||
var body = await client.GetStringAsync("http://localhost/TemplateExpander/ViewWithLayout");
|
var body = await client.GetStringAsync("http://localhost/TemplateExpander/ViewWithLayout");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -338,7 +333,7 @@ View With Layout
|
||||||
var body = await client.GetStringAsync(target);
|
var body = await client.GetStringAsync(target);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -359,7 +354,7 @@ Component With Layout</component-body>";
|
||||||
var body = await client.GetStringAsync("http://localhost/ViewEngine/ViewWithComponentThatHasLayout");
|
var body = await client.GetStringAsync("http://localhost/ViewEngine/ViewWithComponentThatHasLayout");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -408,7 +403,7 @@ Partial that specifies Layout
|
||||||
var body = await client.GetStringAsync("http://localhost/PartialsWithLayout/PartialsRenderedViaRenderPartial");
|
var body = await client.GetStringAsync("http://localhost/PartialsWithLayout/PartialsRenderedViaRenderPartial");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -428,7 +423,7 @@ Partial that does not specify Layout
|
||||||
var body = await client.GetStringAsync("http://localhost/PartialsWithLayout/PartialsRenderedViaPartialAsync");
|
var body = await client.GetStringAsync("http://localhost/PartialsWithLayout/PartialsRenderedViaPartialAsync");
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
Assert.Equal(expected, body.Trim());
|
Assert.Equal(expected, body.Trim(), ignoreLineEndingDifferences: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -448,7 +443,7 @@ Partial that does not specify Layout
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
ResourceFile.UpdateFile(_assembly, outputFile, expectedContent, responseContent);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedContent, responseContent);
|
Assert.Equal(expectedContent, responseContent, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,14 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
#if GENERATE_BASELINES
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
#endif
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
#if GENERATE_BASELINES
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
#endif
|
||||||
using Microsoft.AspNet.Mvc.Razor.Directives;
|
using Microsoft.AspNet.Mvc.Razor.Directives;
|
||||||
using Microsoft.AspNet.Mvc.Razor.Internal;
|
using Microsoft.AspNet.Mvc.Razor.Internal;
|
||||||
using Microsoft.AspNet.Razor;
|
using Microsoft.AspNet.Razor;
|
||||||
|
|
@ -110,29 +114,32 @@ namespace Microsoft.AspNet.Mvc.Razor
|
||||||
};
|
};
|
||||||
var expectedLineMappings = new List<LineMapping>
|
var expectedLineMappings = new List<LineMapping>
|
||||||
{
|
{
|
||||||
BuildLineMapping(documentAbsoluteIndex: 7,
|
|
||||||
documentLineIndex: 0,
|
|
||||||
documentCharacterIndex: 7,
|
|
||||||
generatedAbsoluteIndex: 444,
|
|
||||||
generatedLineIndex: 12,
|
|
||||||
generatedCharacterIndex: 7,
|
|
||||||
contentLength: 8),
|
|
||||||
BuildLineMapping(documentAbsoluteIndex: 33,
|
|
||||||
documentLineIndex: 2,
|
|
||||||
documentCharacterIndex: 14,
|
|
||||||
generatedAbsoluteIndex: 823,
|
|
||||||
generatedLineIndex: 25,
|
|
||||||
generatedCharacterIndex: 14,
|
|
||||||
contentLength: 85),
|
|
||||||
BuildLineMapping(documentAbsoluteIndex: 139,
|
|
||||||
documentLineIndex: 4,
|
|
||||||
documentCharacterIndex: 17,
|
|
||||||
generatedAbsoluteIndex: 2313,
|
|
||||||
generatedLineIndex: 55,
|
|
||||||
generatedCharacterIndex: 95,
|
|
||||||
contentLength: 3),
|
|
||||||
BuildLineMapping(
|
BuildLineMapping(
|
||||||
documentAbsoluteIndex: 166,
|
documentAbsoluteIndex: 7,
|
||||||
|
documentLineIndex: 0,
|
||||||
|
documentCharacterIndex: 7,
|
||||||
|
generatedAbsoluteIndex: 444,
|
||||||
|
generatedLineIndex: 12,
|
||||||
|
generatedCharacterIndex: 7,
|
||||||
|
contentLength: 8),
|
||||||
|
BuildLineMapping(
|
||||||
|
documentAbsoluteIndex: 31,
|
||||||
|
documentLineIndex: 2,
|
||||||
|
documentCharacterIndex: 14,
|
||||||
|
generatedAbsoluteIndex: 823,
|
||||||
|
generatedLineIndex: 25,
|
||||||
|
generatedCharacterIndex: 14,
|
||||||
|
contentLength: 85),
|
||||||
|
BuildLineMapping(
|
||||||
|
documentAbsoluteIndex: 135,
|
||||||
|
documentLineIndex: 4,
|
||||||
|
documentCharacterIndex: 17,
|
||||||
|
generatedAbsoluteIndex: 2313,
|
||||||
|
generatedLineIndex: 55,
|
||||||
|
generatedCharacterIndex: 95,
|
||||||
|
contentLength: 3),
|
||||||
|
BuildLineMapping(
|
||||||
|
documentAbsoluteIndex: 161,
|
||||||
documentLineIndex: 5,
|
documentLineIndex: 5,
|
||||||
documentCharacterIndex: 18,
|
documentCharacterIndex: 18,
|
||||||
generatedAbsoluteIndex: 2626,
|
generatedAbsoluteIndex: 2626,
|
||||||
|
|
@ -185,7 +192,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
||||||
generatedCharacterIndex: 13,
|
generatedCharacterIndex: 13,
|
||||||
contentLength: 4),
|
contentLength: 4),
|
||||||
BuildLineMapping(
|
BuildLineMapping(
|
||||||
documentAbsoluteIndex: 43,
|
documentAbsoluteIndex: 41,
|
||||||
documentLineIndex: 2,
|
documentLineIndex: 2,
|
||||||
documentCharacterIndex: 5,
|
documentCharacterIndex: 5,
|
||||||
generatedAbsoluteIndex: 1353,
|
generatedAbsoluteIndex: 1353,
|
||||||
|
|
@ -210,8 +217,22 @@ namespace Microsoft.AspNet.Mvc.Razor
|
||||||
host.NamespaceImports.Clear();
|
host.NamespaceImports.Clear();
|
||||||
var expectedLineMappings = new List<LineMapping>
|
var expectedLineMappings = new List<LineMapping>
|
||||||
{
|
{
|
||||||
BuildLineMapping(1, 0, 1, 59, 3, 0, 17),
|
BuildLineMapping(
|
||||||
BuildLineMapping(28, 1, 8, 706, 26, 8, 20)
|
documentAbsoluteIndex: 1,
|
||||||
|
documentLineIndex: 0,
|
||||||
|
documentCharacterIndex: 1,
|
||||||
|
generatedAbsoluteIndex: 59,
|
||||||
|
generatedLineIndex: 3,
|
||||||
|
generatedCharacterIndex: 0,
|
||||||
|
contentLength: 17),
|
||||||
|
BuildLineMapping(
|
||||||
|
documentAbsoluteIndex: 27,
|
||||||
|
documentLineIndex: 1,
|
||||||
|
documentCharacterIndex: 8,
|
||||||
|
generatedAbsoluteIndex: 706,
|
||||||
|
generatedLineIndex: 26,
|
||||||
|
generatedCharacterIndex: 8,
|
||||||
|
contentLength: 20),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Act and Assert
|
// Act and Assert
|
||||||
|
|
@ -230,9 +251,30 @@ namespace Microsoft.AspNet.Mvc.Razor
|
||||||
host.NamespaceImports.Clear();
|
host.NamespaceImports.Clear();
|
||||||
var expectedLineMappings = new[]
|
var expectedLineMappings = new[]
|
||||||
{
|
{
|
||||||
BuildLineMapping(7, 0, 7, 214, 6, 7, 7),
|
BuildLineMapping(
|
||||||
BuildLineMapping(24, 1, 8, 731, 26, 8, 20),
|
documentAbsoluteIndex: 7,
|
||||||
BuildLineMapping(54, 2, 8, 957, 34, 8, 23)
|
documentLineIndex: 0,
|
||||||
|
documentCharacterIndex: 7,
|
||||||
|
generatedAbsoluteIndex: 214,
|
||||||
|
generatedLineIndex: 6,
|
||||||
|
generatedCharacterIndex: 7,
|
||||||
|
contentLength: 7),
|
||||||
|
BuildLineMapping(
|
||||||
|
documentAbsoluteIndex: 23,
|
||||||
|
documentLineIndex: 1,
|
||||||
|
documentCharacterIndex: 8,
|
||||||
|
generatedAbsoluteIndex: 731,
|
||||||
|
generatedLineIndex: 26,
|
||||||
|
generatedCharacterIndex: 8,
|
||||||
|
contentLength: 20),
|
||||||
|
BuildLineMapping(
|
||||||
|
documentAbsoluteIndex: 52,
|
||||||
|
documentLineIndex: 2,
|
||||||
|
documentCharacterIndex: 8,
|
||||||
|
generatedAbsoluteIndex: 957,
|
||||||
|
generatedLineIndex: 34,
|
||||||
|
generatedCharacterIndex: 8,
|
||||||
|
contentLength: 23),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Act and Assert
|
// Act and Assert
|
||||||
|
|
@ -251,11 +293,46 @@ namespace Microsoft.AspNet.Mvc.Razor
|
||||||
host.NamespaceImports.Clear();
|
host.NamespaceImports.Clear();
|
||||||
var expectedLineMappings = new[]
|
var expectedLineMappings = new[]
|
||||||
{
|
{
|
||||||
BuildLineMapping(7, 0, 7, 222, 6, 7, 7),
|
BuildLineMapping(
|
||||||
BuildLineMapping(24, 1, 8, 747, 26, 8, 20),
|
documentAbsoluteIndex: 7,
|
||||||
BuildLineMapping(58, 2, 8, 977, 34, 8, 23),
|
documentLineIndex: 0,
|
||||||
BuildLineMapping(93, 3, 8, 1210, 42, 8, 21),
|
documentCharacterIndex: 7,
|
||||||
BuildLineMapping(129, 4, 8, 1441, 50, 8, 24),
|
generatedAbsoluteIndex: 222,
|
||||||
|
generatedLineIndex: 6,
|
||||||
|
generatedCharacterIndex: 7,
|
||||||
|
contentLength: 7),
|
||||||
|
BuildLineMapping(
|
||||||
|
documentAbsoluteIndex: 23,
|
||||||
|
documentLineIndex: 1,
|
||||||
|
documentCharacterIndex: 8,
|
||||||
|
generatedAbsoluteIndex: 747,
|
||||||
|
generatedLineIndex: 26,
|
||||||
|
generatedCharacterIndex: 8,
|
||||||
|
contentLength: 20),
|
||||||
|
BuildLineMapping(
|
||||||
|
documentAbsoluteIndex: 56,
|
||||||
|
documentLineIndex: 2,
|
||||||
|
documentCharacterIndex: 8,
|
||||||
|
generatedAbsoluteIndex: 977,
|
||||||
|
generatedLineIndex: 34,
|
||||||
|
generatedCharacterIndex: 8,
|
||||||
|
contentLength: 23),
|
||||||
|
BuildLineMapping(
|
||||||
|
documentAbsoluteIndex: 90,
|
||||||
|
documentLineIndex: 3,
|
||||||
|
documentCharacterIndex: 8,
|
||||||
|
generatedAbsoluteIndex: 1210,
|
||||||
|
generatedLineIndex: 42,
|
||||||
|
generatedCharacterIndex: 8,
|
||||||
|
contentLength: 21),
|
||||||
|
BuildLineMapping(
|
||||||
|
documentAbsoluteIndex: 125,
|
||||||
|
documentLineIndex: 4,
|
||||||
|
documentCharacterIndex: 8,
|
||||||
|
generatedAbsoluteIndex: 1441,
|
||||||
|
generatedLineIndex: 50,
|
||||||
|
generatedCharacterIndex: 8,
|
||||||
|
contentLength: 24),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Act and Assert
|
// Act and Assert
|
||||||
|
|
@ -302,7 +379,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
||||||
#if GENERATE_BASELINES
|
#if GENERATE_BASELINES
|
||||||
ResourceFile.UpdateFile(_assembly, outputFile, expectedCode, results.GeneratedCode);
|
ResourceFile.UpdateFile(_assembly, outputFile, expectedCode, results.GeneratedCode);
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedCode, results.GeneratedCode);
|
Assert.Equal(expectedCode, results.GeneratedCode, ignoreLineEndingDifferences: true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -362,7 +439,7 @@ namespace Microsoft.AspNet.Mvc.Razor
|
||||||
ResourceFile.UpdateFile(_assembly, lineMappingFile, previousContent: null, content: lineMappings.ToString());
|
ResourceFile.UpdateFile(_assembly, lineMappingFile, previousContent: null, content: lineMappings.ToString());
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
Assert.Equal(expectedCode, results.GeneratedCode);
|
Assert.Equal(expectedCode, results.GeneratedCode, ignoreLineEndingDifferences: true);
|
||||||
Assert.Equal(expectedLineMappings, results.DesignTimeLineMappings);
|
Assert.Equal(expectedLineMappings, results.DesignTimeLineMappings);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#pragma checksum "TestFiles/Input/Basic.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "63d2634be31f68aa89a0c1561d67c73cc446f3d4"
|
#pragma checksum "TestFiles/Input/Basic.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "4901c9b2325c62315b9048c930cac987201ccbab"
|
||||||
namespace Asp
|
namespace Asp
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
|
|
@ -34,18 +34,18 @@ namespace Asp
|
||||||
EndContext();
|
EndContext();
|
||||||
WriteAttribute("class", Tuple.Create(" class=\"", 4), Tuple.Create("\"", 17),
|
WriteAttribute("class", Tuple.Create(" class=\"", 4), Tuple.Create("\"", 17),
|
||||||
Tuple.Create(Tuple.Create("", 12), Tuple.Create<System.Object, System.Int32>(logo, 12), false));
|
Tuple.Create(Tuple.Create("", 12), Tuple.Create<System.Object, System.Int32>(logo, 12), false));
|
||||||
BeginContext(18, 24, true);
|
BeginContext(18, 22, true);
|
||||||
WriteLiteral(">\r\n Hello world\r\n ");
|
WriteLiteral(">\n Hello world\n ");
|
||||||
EndContext();
|
EndContext();
|
||||||
BeginContext(43, 21, false);
|
BeginContext(41, 21, false);
|
||||||
#line 3 "TestFiles/Input/Basic.cshtml"
|
#line 3 "TestFiles/Input/Basic.cshtml"
|
||||||
Write(Html.Input("SomeKey"));
|
Write(Html.Input("SomeKey"));
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
EndContext();
|
EndContext();
|
||||||
BeginContext(64, 8, true);
|
BeginContext(62, 7, true);
|
||||||
WriteLiteral("\r\n</div>");
|
WriteLiteral("\n</div>");
|
||||||
EndContext();
|
EndContext();
|
||||||
}
|
}
|
||||||
#pragma warning restore 1998
|
#pragma warning restore 1998
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#pragma checksum "TestFiles/Input/Inject.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "424b7fe9f12352c59210b5fa8c74ca8c9c67de81"
|
#pragma checksum "TestFiles/Input/Inject.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "1b6d0816c4801cc45d2f51f612298d2e978b8dac"
|
||||||
namespace Asp
|
namespace Asp
|
||||||
{
|
{
|
||||||
#line 1 "TestFiles/Input/Inject.cshtml"
|
#line 1 "TestFiles/Input/Inject.cshtml"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#pragma checksum "TestFiles/Input/InjectWithModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "0c0e10d3fd8f5bf30eabc22ca0ee91355a13426d"
|
#pragma checksum "TestFiles/Input/InjectWithModel.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a3c84d50826508cf6aab272b5b403b41f22eb058"
|
||||||
namespace Asp
|
namespace Asp
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#pragma checksum "TestFiles/Input/InjectWithSemicolon.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "b753615982659a9805e6213ceced76ba06782038"
|
#pragma checksum "TestFiles/Input/InjectWithSemicolon.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "76a79c64a24a4b239eaa7f70aa9a708c5794e050"
|
||||||
namespace Asp
|
namespace Asp
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#pragma checksum "TestFiles/Input/Model.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "2c1e88396568d309c236020e59bf2abacfadd612"
|
#pragma checksum "TestFiles/Input/Model.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "dbb4c96d18dd379f760a081c6ff84ed9fd31b82b"
|
||||||
namespace Asp
|
namespace Asp
|
||||||
{
|
{
|
||||||
using System;
|
using System;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#pragma checksum "TestFiles/Input/ModelExpressionTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "3b1d4af116a70f83c556ece1980f2e9364e6baa7"
|
#pragma checksum "TestFiles/Input/ModelExpressionTagHelper.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "a866c3c5622349399a04557339d06e12178fb260"
|
||||||
namespace Asp
|
namespace Asp
|
||||||
{
|
{
|
||||||
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
|
using Microsoft.AspNet.Razor.Runtime.TagHelpers;
|
||||||
|
|
@ -45,8 +45,8 @@ namespace Asp
|
||||||
public override async Task ExecuteAsync()
|
public override async Task ExecuteAsync()
|
||||||
{
|
{
|
||||||
__tagHelperRunner = __tagHelperRunner ?? new Microsoft.AspNet.Razor.Runtime.TagHelpers.TagHelperRunner();
|
__tagHelperRunner = __tagHelperRunner ?? new Microsoft.AspNet.Razor.Runtime.TagHelpers.TagHelperRunner();
|
||||||
BeginContext(120, 2, true);
|
BeginContext(117, 1, true);
|
||||||
WriteLiteral("\r\n");
|
WriteLiteral("\n");
|
||||||
EndContext();
|
EndContext();
|
||||||
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", true, "test", async() => {
|
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", true, "test", async() => {
|
||||||
}
|
}
|
||||||
|
|
@ -60,12 +60,12 @@ __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__mo
|
||||||
#line hidden
|
#line hidden
|
||||||
__tagHelperExecutionContext.AddTagHelperAttribute("for", __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For);
|
__tagHelperExecutionContext.AddTagHelperAttribute("for", __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For);
|
||||||
__tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
|
__tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
|
||||||
BeginContext(122, 24, false);
|
BeginContext(118, 24, false);
|
||||||
await WriteTagHelperAsync(__tagHelperExecutionContext);
|
await WriteTagHelperAsync(__tagHelperExecutionContext);
|
||||||
EndContext();
|
EndContext();
|
||||||
__tagHelperExecutionContext = __tagHelperScopeManager.End();
|
__tagHelperExecutionContext = __tagHelperScopeManager.End();
|
||||||
BeginContext(146, 2, true);
|
BeginContext(142, 1, true);
|
||||||
WriteLiteral("\r\n");
|
WriteLiteral("\n");
|
||||||
EndContext();
|
EndContext();
|
||||||
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", true, "test", async() => {
|
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", true, "test", async() => {
|
||||||
}
|
}
|
||||||
|
|
@ -79,7 +79,7 @@ __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For = CreateModelExpression(__mo
|
||||||
#line hidden
|
#line hidden
|
||||||
__tagHelperExecutionContext.AddTagHelperAttribute("for", __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For);
|
__tagHelperExecutionContext.AddTagHelperAttribute("for", __Microsoft_AspNet_Mvc_Razor_InputTestTagHelper.For);
|
||||||
__tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
|
__tagHelperExecutionContext.Output = await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);
|
||||||
BeginContext(148, 27, false);
|
BeginContext(143, 27, false);
|
||||||
await WriteTagHelperAsync(__tagHelperExecutionContext);
|
await WriteTagHelperAsync(__tagHelperExecutionContext);
|
||||||
EndContext();
|
EndContext();
|
||||||
__tagHelperExecutionContext = __tagHelperScopeManager.End();
|
__tagHelperExecutionContext = __tagHelperScopeManager.End();
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
|
|
@ -62,7 +63,26 @@ namespace Microsoft.AspNet.Mvc
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return assembly.GetManifestResourceStream(fullName);
|
var stream = assembly.GetManifestResourceStream(fullName);
|
||||||
|
if (sourceFile)
|
||||||
|
{
|
||||||
|
// Normalize line endings to '\n' (LF). This removes core.autocrlf, core.eol, core.safecrlf, and
|
||||||
|
// .gitattributes from the equation and treats "\r\n", "\r", and "\n" as equivalent. Does not handle
|
||||||
|
// some obscure line endings (e.g. "\n\r") but otherwise ensures checksums and line mappings are
|
||||||
|
// consistent.
|
||||||
|
string text;
|
||||||
|
using (var streamReader = new StreamReader(stream))
|
||||||
|
{
|
||||||
|
text = streamReader.ReadToEnd()
|
||||||
|
.Replace("\r\n", "\n") // Windows line endings
|
||||||
|
.Replace("\r", "\n"); // Older Mac OS line endings
|
||||||
|
}
|
||||||
|
|
||||||
|
var bytes = Encoding.UTF8.GetBytes(text);
|
||||||
|
stream = new MemoryStream(bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -101,13 +121,7 @@ namespace Microsoft.AspNet.Mvc
|
||||||
|
|
||||||
using (var streamReader = new StreamReader(stream))
|
using (var streamReader = new StreamReader(stream))
|
||||||
{
|
{
|
||||||
var content = await streamReader.ReadToEndAsync();
|
return await streamReader.ReadToEndAsync();
|
||||||
|
|
||||||
// Normalize line endings to Environment.NewLine. This removes core.autocrlf, core.eol,
|
|
||||||
// core.safecrlf, and .gitattributes from the equation and matches what MVC returns.
|
|
||||||
return content
|
|
||||||
.Replace("\r", string.Empty)
|
|
||||||
.Replace("\n", Environment.NewLine);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -147,13 +161,7 @@ namespace Microsoft.AspNet.Mvc
|
||||||
|
|
||||||
using (var streamReader = new StreamReader(stream))
|
using (var streamReader = new StreamReader(stream))
|
||||||
{
|
{
|
||||||
var content = streamReader.ReadToEnd();
|
return streamReader.ReadToEnd();
|
||||||
|
|
||||||
// Normalize line endings to Environment.NewLine. This removes core.autocrlf, core.eol,
|
|
||||||
// core.safecrlf, and .gitattributes from the equation and matches what MVC returns.
|
|
||||||
return content
|
|
||||||
.Replace("\r", string.Empty)
|
|
||||||
.Replace("\n", Environment.NewLine);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -178,10 +186,19 @@ namespace Microsoft.AspNet.Mvc
|
||||||
[Conditional("GENERATE_BASELINES")]
|
[Conditional("GENERATE_BASELINES")]
|
||||||
public static void UpdateFile(Assembly assembly, string resourceName, string previousContent, string content)
|
public static void UpdateFile(Assembly assembly, string resourceName, string previousContent, string content)
|
||||||
{
|
{
|
||||||
if (!string.Equals(previousContent, content, StringComparison.Ordinal))
|
// Normalize line endings to '\n' for comparison. This removes Environment.NewLine from the equation. Not
|
||||||
|
// worth updating files just because we generate baselines on a different system.
|
||||||
|
var normalizedPreviousContent = previousContent
|
||||||
|
?.Replace("\r\n", "\n")
|
||||||
|
.Replace("\r", "\n");
|
||||||
|
var normalizedContent = content
|
||||||
|
.Replace("\r\n", "\n")
|
||||||
|
.Replace("\r", "\n");
|
||||||
|
|
||||||
|
if (!string.Equals(normalizedPreviousContent, normalizedContent, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
// The DNX runtime compiles every file under the resources folder as a resource available at runtime with
|
// The DNX runtime compiles every file under the resources folder as a resource available at runtime
|
||||||
// the same name as the file name. Need to update this file on disc.
|
// with the same name as the file name. Need to update this file on disc.
|
||||||
var projectName = assembly.GetName().Name;
|
var projectName = assembly.GetName().Name;
|
||||||
var projectPath = GetProjectPath(projectName);
|
var projectPath = GetProjectPath(projectName);
|
||||||
var fullPath = Path.Combine(projectPath, resourceName);
|
var fullPath = Path.Combine(projectPath, resourceName);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNet.Builder;
|
using Microsoft.AspNet.Builder;
|
||||||
using Microsoft.AspNet.Http;
|
using Microsoft.AspNet.Http;
|
||||||
|
using Microsoft.AspNet.Mvc.Razor.Compilation;
|
||||||
using Microsoft.AspNet.PageExecutionInstrumentation;
|
using Microsoft.AspNet.PageExecutionInstrumentation;
|
||||||
using Microsoft.Framework.DependencyInjection;
|
using Microsoft.Framework.DependencyInjection;
|
||||||
|
|
||||||
|
|
@ -15,6 +16,9 @@ namespace RazorPageExecutionInstrumentationWebSite
|
||||||
// Set up application services
|
// Set up application services
|
||||||
public void ConfigureServices(IServiceCollection services)
|
public void ConfigureServices(IServiceCollection services)
|
||||||
{
|
{
|
||||||
|
// Normalize line endings to avoid changes in instrumentation locations between systems.
|
||||||
|
services.TryAdd(ServiceDescriptor.Transient<IRazorCompilationService, TestRazorCompilationService>());
|
||||||
|
|
||||||
// Add MVC services to the services container
|
// Add MVC services to the services container
|
||||||
services.AddMvc();
|
services.AddMvc();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
// Copyright (c) .NET Foundation. All rights reserved.
|
||||||
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||||
|
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using Microsoft.AspNet.Mvc.Razor;
|
||||||
|
using Microsoft.AspNet.Mvc.Razor.Compilation;
|
||||||
|
using Microsoft.AspNet.Razor.CodeGenerators;
|
||||||
|
using Microsoft.Framework.OptionsModel;
|
||||||
|
|
||||||
|
namespace RazorPageExecutionInstrumentationWebSite
|
||||||
|
{
|
||||||
|
public class TestRazorCompilationService : RazorCompilationService
|
||||||
|
{
|
||||||
|
public TestRazorCompilationService(
|
||||||
|
ICompilationService compilationService,
|
||||||
|
IMvcRazorHost razorHost,
|
||||||
|
IOptions<RazorViewEngineOptions> viewEngineOptions)
|
||||||
|
: base(compilationService, razorHost, viewEngineOptions)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override GeneratorResults GenerateCode(string relativePath, Stream inputStream)
|
||||||
|
{
|
||||||
|
// Normalize line endings to '\n' (LF). This removes core.autocrlf, core.eol, core.safecrlf, and
|
||||||
|
// .gitattributes from the equation and treats "\r\n", "\r", and "\n" as equivalent. Does not handle
|
||||||
|
// some obscure line endings (e.g. "\n\r") but otherwise ensures instrumentation locations are
|
||||||
|
// consistent.
|
||||||
|
string text;
|
||||||
|
using (var streamReader = new StreamReader(inputStream))
|
||||||
|
{
|
||||||
|
text = streamReader.ReadToEnd()
|
||||||
|
.Replace("\r\n", "\n") // Windows line endings
|
||||||
|
.Replace("\r", "\n"); // Older Mac OS line endings
|
||||||
|
}
|
||||||
|
|
||||||
|
var bytes = Encoding.UTF8.GetBytes(text);
|
||||||
|
inputStream = new MemoryStream(bytes);
|
||||||
|
|
||||||
|
return base.GenerateCode(relativePath, inputStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue