Fix failing tests
This commit is contained in:
parent
b341340d1f
commit
b74ea5d74e
|
|
@ -55,7 +55,6 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
public void Execute_ExecutesPhasesInOrder()
|
||||
{
|
||||
// Arrange
|
||||
|
||||
var codeDocument = TestRazorCodeDocument.CreateEmpty();
|
||||
|
||||
// We're going to set up mocks to simulate a sequence of passes. We don't care about
|
||||
|
|
@ -63,13 +62,16 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
var originalSyntaxTree = RazorSyntaxTree.Parse(codeDocument.Source);
|
||||
var firstPassSyntaxTree = RazorSyntaxTree.Parse(codeDocument.Source);
|
||||
var secondPassSyntaxTree = RazorSyntaxTree.Parse(codeDocument.Source);
|
||||
codeDocument.SetSyntaxTree(originalSyntaxTree);
|
||||
|
||||
var firstPass = new Mock<IRazorSyntaxTreePass>(MockBehavior.Strict);
|
||||
firstPass.SetupGet(m => m.Order).Returns(0);
|
||||
firstPass.SetupProperty(m => m.Engine);
|
||||
firstPass.Setup(m => m.Execute(codeDocument, originalSyntaxTree)).Returns(firstPassSyntaxTree);
|
||||
|
||||
var secondPass = new Mock<IRazorSyntaxTreePass>(MockBehavior.Strict);
|
||||
secondPass.SetupGet(m => m.Order).Returns(0);
|
||||
secondPass.SetupGet(m => m.Order).Returns(1);
|
||||
secondPass.SetupProperty(m => m.Engine);
|
||||
secondPass.Setup(m => m.Execute(codeDocument, firstPassSyntaxTree)).Returns(secondPassSyntaxTree);
|
||||
|
||||
var phase = new DefaultRazorSyntaxTreePhase();
|
||||
|
|
@ -78,8 +80,8 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
{
|
||||
b.Phases.Add(phase);
|
||||
|
||||
b.Features.Add(secondPass.Object);
|
||||
b.Features.Add(firstPass.Object);
|
||||
b.Features.Add(secondPass.Object);
|
||||
});
|
||||
|
||||
// Act
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
|
@ -18,8 +19,8 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
|
||||
// Assert
|
||||
Assert.IsType<DefaultRazorEngine>(engine);
|
||||
Assert.Empty(engine.Features);
|
||||
Assert.Empty(engine.Phases);
|
||||
AssertDefaultFeatures(engine.Features);
|
||||
AssertDefaultPhases(engine.Phases);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -31,8 +32,8 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
|
||||
// Assert
|
||||
Assert.IsType<DefaultRazorEngine>(engine);
|
||||
Assert.Empty(engine.Features);
|
||||
Assert.Empty(engine.Phases);
|
||||
AssertDefaultFeatures(engine.Features);
|
||||
AssertDefaultPhases(engine.Phases);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -69,5 +70,18 @@ namespace Microsoft.AspNetCore.Razor.Evolution
|
|||
p => Assert.Same(phases[0], p),
|
||||
p => Assert.Same(phases[1], p));
|
||||
}
|
||||
|
||||
private static void AssertDefaultFeatures(IEnumerable<IRazorEngineFeature> features)
|
||||
{
|
||||
Assert.Empty(features);
|
||||
}
|
||||
|
||||
private static void AssertDefaultPhases(IReadOnlyList<IRazorEnginePhase> features)
|
||||
{
|
||||
Assert.Collection(
|
||||
features,
|
||||
f => Assert.IsType<DefaultRazorParsingPhase>(f),
|
||||
f => Assert.IsType<DefaultRazorSyntaxTreePhase>(f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue