Fix #1305 move instrumentation to MVC
This commit is contained in:
parent
682d630fa2
commit
86d045c667
|
|
@ -3,11 +3,12 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
using Microsoft.AspNetCore.Razor.Language.Intermediate;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Language
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
||||
{
|
||||
public class DefaultInstrumentationPass : RazorIRPassBase, IRazorIROptimizationPass
|
||||
public class InstrumentationPass : RazorIRPassBase, IRazorIROptimizationPass
|
||||
{
|
||||
public override int Order => DefaultFeatureOrder;
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
|||
|
||||
if (!builder.DesignTime)
|
||||
{
|
||||
builder.Features.Add(new DefaultInstrumentationPass());
|
||||
builder.Features.Add(new InstrumentationPass());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,14 @@
|
|||
// 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 Microsoft.AspNetCore.Razor.Language;
|
||||
using Microsoft.AspNetCore.Razor.Language.Intermediate;
|
||||
using Xunit;
|
||||
using static Microsoft.AspNetCore.Razor.Language.Intermediate.RazorIRAssert;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Language
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.Extensions
|
||||
{
|
||||
public class DefaultInstrumentationPassTest
|
||||
public class InstrumentationPassTest
|
||||
{
|
||||
[Fact]
|
||||
public void InstrumentationPass_InstrumentsHtml()
|
||||
|
|
@ -28,7 +29,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
var irDocument = (DocumentIRNode)builder.Build();
|
||||
|
||||
var pass = new DefaultInstrumentationPass();
|
||||
var pass = new InstrumentationPass();
|
||||
|
||||
// Act
|
||||
pass.ExecuteCore(TestRazorCodeDocument.CreateEmpty(), irDocument);
|
||||
|
|
@ -37,7 +38,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
Children(
|
||||
irDocument,
|
||||
n => BeginInstrumentation("1, 1, true", n),
|
||||
n => Html("Hi", n),
|
||||
n => RazorIRAssert.Html("Hi", n),
|
||||
n => EndInstrumentation(n));
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +57,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
var irDocument = (DocumentIRNode)builder.Build();
|
||||
|
||||
var pass = new DefaultInstrumentationPass();
|
||||
var pass = new InstrumentationPass();
|
||||
|
||||
// Act
|
||||
pass.ExecuteCore(TestRazorCodeDocument.CreateEmpty(), irDocument);
|
||||
|
|
@ -64,7 +65,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
// Assert
|
||||
Children(
|
||||
irDocument,
|
||||
n => Html("Hi", n));
|
||||
n => RazorIRAssert.Html("Hi", n));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -84,7 +85,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
var irDocument = (DocumentIRNode)builder.Build();
|
||||
|
||||
var pass = new DefaultInstrumentationPass();
|
||||
var pass = new InstrumentationPass();
|
||||
|
||||
// Act
|
||||
pass.ExecuteCore(TestRazorCodeDocument.CreateEmpty(), irDocument);
|
||||
|
|
@ -111,7 +112,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
var irDocument = (DocumentIRNode)builder.Build();
|
||||
|
||||
var pass = new DefaultInstrumentationPass();
|
||||
var pass = new InstrumentationPass();
|
||||
|
||||
// Act
|
||||
pass.ExecuteCore(TestRazorCodeDocument.CreateEmpty(), irDocument);
|
||||
|
|
@ -147,7 +148,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
var irDocument = (DocumentIRNode)builder.Build();
|
||||
|
||||
var pass = new DefaultInstrumentationPass();
|
||||
var pass = new InstrumentationPass();
|
||||
|
||||
// Act
|
||||
pass.ExecuteCore(TestRazorCodeDocument.CreateEmpty(), irDocument);
|
||||
|
|
@ -195,7 +196,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
var irDocument = (DocumentIRNode)builder.Build();
|
||||
|
||||
var pass = new DefaultInstrumentationPass();
|
||||
var pass = new InstrumentationPass();
|
||||
|
||||
// Act
|
||||
pass.ExecuteCore(TestRazorCodeDocument.CreateEmpty(), irDocument);
|
||||
|
|
@ -232,7 +233,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
var irDocument = (DocumentIRNode)builder.Build();
|
||||
|
||||
var pass = new DefaultInstrumentationPass();
|
||||
var pass = new InstrumentationPass();
|
||||
|
||||
// Act
|
||||
pass.ExecuteCore(TestRazorCodeDocument.CreateEmpty(), irDocument);
|
||||
|
|
@ -262,7 +263,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
var irDocument = (DocumentIRNode)builder.Build();
|
||||
|
||||
var pass = new DefaultInstrumentationPass();
|
||||
var pass = new InstrumentationPass();
|
||||
|
||||
// Act
|
||||
pass.ExecuteCore(TestRazorCodeDocument.CreateEmpty(), irDocument);
|
||||
|
|
@ -293,7 +294,7 @@ namespace Microsoft.AspNetCore.Razor.Language
|
|||
|
||||
var irDocument = (DocumentIRNode)builder.Build();
|
||||
|
||||
var pass = new DefaultInstrumentationPass();
|
||||
var pass = new InstrumentationPass();
|
||||
|
||||
// Act
|
||||
pass.ExecuteCore(TestRazorCodeDocument.CreateEmpty(), irDocument);
|
||||
|
|
@ -3,9 +3,11 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Razor.Language;
|
||||
using Microsoft.AspNetCore.Razor.Language.IntegrationTests;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
|
||||
namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.IntegrationTests
|
||||
{
|
||||
public class InstrumentationPassIntegrationTest : IntegrationTestBase
|
||||
{
|
||||
|
|
@ -43,7 +45,7 @@ namespace Microsoft.AspNetCore.Razor.Language.IntegrationTests
|
|||
var engine = RazorEngine.Create(b =>
|
||||
{
|
||||
b.AddTagHelpers(descriptors);
|
||||
b.Features.Add(new DefaultInstrumentationPass());
|
||||
b.Features.Add(new InstrumentationPass());
|
||||
});
|
||||
|
||||
var document = CreateCodeDocument();
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// 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.Runtime.CompilerServices;
|
||||
[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Language.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")]
|
||||
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
|
||||
Loading…
Reference in New Issue