public void CreateCodeBuilder_PassesCodeGeneratorThroughDecorateMethodOnHost() { // Arrange var mockHost = new Mock <RazorEngineHost>(new CSharpRazorCodeLanguage()) { CallBase = true }; var codeBuilderContext = new CodeBuilderContext( mockHost.Object, "different-class", "different-ns", string.Empty, shouldGenerateLinePragmas: true); var expected = new CSharpCodeBuilder(codeBuilderContext); mockHost.Setup(h => h.DecorateCodeBuilder(It.IsAny <CSharpCodeBuilder>(), codeBuilderContext)) .Returns(expected); var engine = new RazorTemplateEngine(mockHost.Object); // Act var actual = engine.CreateCodeBuilder(codeBuilderContext); // Assert Assert.Equal(expected, actual); }
public void CreateCodeBuilder_PassesCodeGeneratorThroughDecorateMethodOnHost() { // Arrange var mockHost = new Mock<RazorEngineHost>(new CSharpRazorCodeLanguage()) { CallBase = true }; var context = CodeGeneratorContext.Create(mockHost.Object, "different-class", "different-ns", string.Empty, shouldGenerateLinePragmas: true); var expected = new CSharpCodeBuilder(context); mockHost.Setup(h => h.DecorateCodeBuilder(It.IsAny<CSharpCodeBuilder>(), context)) .Returns(expected); var engine = new RazorTemplateEngine(mockHost.Object); // Act var actual = engine.CreateCodeBuilder(context); // Assert Assert.Equal(expected, actual); }