{
- BuildLineMapping(documentAbsoluteIndex: 7,
+ BuildLineMapping(documentAbsoluteIndex: 7,
documentLineIndex: 0,
- documentCharacterIndex: 7,
+ documentCharacterIndex: 7,
generatedAbsoluteIndex: 444,
generatedLineIndex: 12,
- generatedCharacterIndex: 7,
+ generatedCharacterIndex: 7,
contentLength: 8),
BuildLineMapping(documentAbsoluteIndex: 33,
documentLineIndex: 2,
@@ -39,8 +52,8 @@ namespace Microsoft.AspNet.Mvc.Razor
};
// Act and Assert
- RunDesignTimeTest(host,
- testName: "ModelExpressionTagHelper",
+ RunDesignTimeTest(host,
+ testName: "ModelExpressionTagHelper",
expectedLineMappings: expectedLineMappings);
}
diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/Basic.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/Basic.cs
index f32f058b6f..99120136ef 100644
--- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/Basic.cs
+++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/Basic.cs
@@ -27,16 +27,24 @@ namespace Asp
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
+ BeginContext(0, 4, true);
WriteLiteral("(logo, 12), false));
+ BeginContext(18, 24, true);
WriteLiteral(">\r\n Hello world\r\n ");
+ EndContext();
+ BeginContext(43, 21, false);
#line 3 "TestFiles/Input/Basic.cshtml"
Write(Html.Input("SomeKey"));
#line default
#line hidden
+ EndContext();
+ BeginContext(64, 8, true);
WriteLiteral("\r\n
");
+ EndContext();
}
#pragma warning restore 1998
}
diff --git a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs
index 2687d004cd..581614783e 100644
--- a/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs
+++ b/test/Microsoft.AspNet.Mvc.Razor.Host.Test/TestFiles/Output/Runtime/ModelExpressionTagHelper.cs
@@ -40,7 +40,9 @@ namespace Asp
#pragma warning disable 1998
public override async Task ExecuteAsync()
{
+ BeginContext(120, 2, true);
WriteLiteral("\r\n");
+ EndContext();
__tagHelperExecutionContext = __tagHelperScopeManager.Begin("inputTest");
__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper = CreateTagHelper();
__tagHelperExecutionContext.Add(__Microsoft_AspNet_Mvc_Razor_InputTestTagHelper);
diff --git a/test/Microsoft.AspNet.Mvc.Razor.Test/Compilation/CompilerCacheTest.cs b/test/Microsoft.AspNet.Mvc.Razor.Test/Compilation/CompilerCacheTest.cs
index d11654d5df..9dad480b21 100644
--- a/test/Microsoft.AspNet.Mvc.Razor.Test/Compilation/CompilerCacheTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Razor.Test/Compilation/CompilerCacheTest.cs
@@ -34,7 +34,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
};
// Act
- var actual = cache.GetOrAdd(runtimeFileInfo, false, () => expected);
+ var actual = cache.GetOrAdd(runtimeFileInfo, () => expected);
// Assert
Assert.Same(expected, actual);
@@ -140,8 +140,7 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
// Act
var actual = cache.GetOrAdd(runtimeFileInfo,
- enableInstrumentation: false,
- compile: () => CompilationResult.Successful(resultViewType));
+ compile: () => CompilationResult.Successful(resultViewType));
// Assert
if (swapsPreCompile)
@@ -175,9 +174,9 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
};
// Act
- cache.GetOrAdd(runtimeFileInfo, false, () => uncachedResult);
- var actual1 = cache.GetOrAdd(runtimeFileInfo, false, () => uncachedResult);
- var actual2 = cache.GetOrAdd(runtimeFileInfo, false, () => uncachedResult);
+ cache.GetOrAdd(runtimeFileInfo, () => uncachedResult);
+ var actual1 = cache.GetOrAdd(runtimeFileInfo, () => uncachedResult);
+ var actual2 = cache.GetOrAdd(runtimeFileInfo, () => uncachedResult);
// Assert
Assert.NotSame(uncachedResult, actual1);
@@ -190,40 +189,5 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
Assert.Null(actual2.CompiledContent);
Assert.Same(type, actual2.CompiledType);
}
-
- [Fact]
- public void GetOrAdd_IgnoresCache_IfCachedItemIsNotInstrumentedAndEnableInstrumentationIsTrue()
- {
- // Arrange
- var lastModified = DateTime.UtcNow;
- var cache = new CompilerCache();
- var fileInfo = new Mock();
- fileInfo.SetupGet(f => f.PhysicalPath)
- .Returns("test");
- fileInfo.SetupGet(f => f.LastModified)
- .Returns(lastModified);
- var type = GetType();
- var uncachedResult1 = UncachedCompilationResult.Successful(type, "hello world");
- var uncachedResult2 = UncachedCompilationResult.Successful(typeof(object), "hello world");
- var uncachedResult3 = UncachedCompilationResult.Successful(typeof(Guid), "hello world");
-
- var runtimeFileInfo = new RelativeFileInfo()
- {
- FileInfo = fileInfo.Object,
- RelativePath = "test",
- };
-
- // Act
- cache.GetOrAdd(runtimeFileInfo, false, () => uncachedResult1);
- var actual1 = cache.GetOrAdd(runtimeFileInfo, true, () => uncachedResult2);
- var actual2 = cache.GetOrAdd(runtimeFileInfo, false, () => uncachedResult3);
-
- // Assert
- Assert.Same(uncachedResult2, actual1);
- Assert.Same(typeof(object), actual1.CompiledType);
-
- Assert.NotSame(actual2, uncachedResult3);
- Assert.Same(typeof(object), actual2.CompiledType);
- }
}
}
\ No newline at end of file
diff --git a/test/Microsoft.AspNet.Mvc.Razor.Test/RazorCompilationServiceTest.cs b/test/Microsoft.AspNet.Mvc.Razor.Test/RazorCompilationServiceTest.cs
index 87086c76bd..8338be5dd8 100644
--- a/test/Microsoft.AspNet.Mvc.Razor.Test/RazorCompilationServiceTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Razor.Test/RazorCompilationServiceTest.cs
@@ -1,10 +1,7 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System;
using System.IO;
-using System.Linq;
-using System.Reflection;
using Microsoft.AspNet.FileSystems;
using Microsoft.AspNet.Razor;
using Microsoft.AspNet.Razor.Generator.Compiler;
@@ -44,42 +41,12 @@ namespace Microsoft.AspNet.Mvc.Razor.Test
};
// Act
- razorService.Compile(relativeFileInfo, isInstrumented: false);
+ razorService.Compile(relativeFileInfo);
// Assert
host.Verify();
}
- [Theory]
- [InlineData(false)]
- [InlineData(true)]
- public void CompileSetsEnableInstrumentationOnHost(bool enableInstrumentation)
- {
- // Arrange
- var host = new Mock();
- host.SetupAllProperties();
- host.Setup(h => h.GenerateCode(It.IsAny(), It.IsAny()))
- .Returns(GetGeneratorResult());
-
- var compiler = new Mock();
- compiler.Setup(c => c.Compile(It.IsAny(), It.IsAny()))
- .Returns(CompilationResult.Successful(GetType()));
-
- var razorService = new RazorCompilationService(compiler.Object, host.Object);
-
- var relativeFileInfo = new RelativeFileInfo()
- {
- FileInfo = Mock.Of(),
- RelativePath = @"views\index\home.cshtml",
- };
-
- // Act
- razorService.Compile(relativeFileInfo, isInstrumented: enableInstrumentation);
-
- // Assert
- Assert.Equal(enableInstrumentation, host.Object.EnableInstrumentation);
- }
-
private static GeneratorResults GetGeneratorResult()
{
return new GeneratorResults(