Exemplo n.º 1
0
        public void CompileTemplateFactory_CallsTreeParser()
        {
            // Arrange
            var fakeHamlSource = ViewSourceBuilder.Create();

            // Act
            var compiledTemplate = new TemplateFactoryFactory(_templateContentProviderMock.Object, _parserMock.Object,
                _documentWalkerMock.Object, _compilerMock.Object, new List<string>(), new List<string>());
            compiledTemplate.CompileTemplateFactory("className", fakeHamlSource);

            // Assert
            _parserMock.Verify(x => x.ParseViewSource(fakeHamlSource));
        }
Exemplo n.º 2
0
        public void CompileTemplateFactory_CallsCompile()
        {
            // Arrange
            const string fakeTemplateSource = "FakeTemplateSource";
            _documentWalkerMock.Setup(x => x.Walk(It.IsAny<HamlDocument>(), It.IsAny<string>(),
                It.IsAny<Type>(), It.IsAny<IList<string>>()))
                .Returns(fakeTemplateSource);
            var viewSource = ViewSourceBuilder.Create();
            var assemblies = new List<string>();

            // Act
            var compiledTemplate = new TemplateFactoryFactory(_contentProviderMock.Object, _viewSourceParserMock.Object,
                _documentWalkerMock.Object, _compilerMock.Object, new List<string>(), assemblies);
            compiledTemplate.CompileTemplateFactory(viewSource.GetClassName(), viewSource);

            // Assert
            _compilerMock.Verify(x => x.Compile(fakeTemplateSource, viewSource.GetClassName(), assemblies));
        }
Exemplo n.º 3
0
        public void CompileTemplateFactory_CallsDocumentWalker()
        {
            // Arrange
            const string className = "className";
            var baseType = typeof(Template);

            var fakeHamlDocument = HamlDocumentBuilder.Create("");
            _viewSourceParserMock.Setup(x => x.Parse(It.IsAny<ViewSource>()))
                .Returns(fakeHamlDocument);
            var viewSource = ViewSourceBuilder.Create();
            var imports = new List<string>();

            // Act
            var compiledTemplate = new TemplateFactoryFactory(_contentProviderMock.Object, _viewSourceParserMock.Object,
                _documentWalkerMock.Object, _compilerMock.Object, new List<string>(), imports);
            compiledTemplate.CompileTemplateFactory(className, new ViewSourceCollection { viewSource }, baseType);

            // Assert
            _documentWalkerMock.Verify(x => x.Walk(fakeHamlDocument, className, baseType, imports));
        }