protected override void Arrange()
            {
                var expectedTemplateString = @"using EdFi.Ods.Xml.XmlMetadata;";

                var templatesByTemplateName = new Dictionary <string, string>
                {
                    { templateName, expectedTemplateString },
                    { "template2", "template2 string" }
                };

                _templateWriterData = new TemplateWriterData
                {
                    Model = new
                    {
                        NamespaceName = "testNamespace",
                        ClassName     = "testClass",
                        InterfaceName = "testInterfaceName"
                    },
                    TemplateSet = new TemplateSet {
                        Name = templateName
                    }
                };

                _mustacheTemplateProvider = Stub <IMustacheTemplateProvider>();

                A.CallTo(() => _mustacheTemplateProvider.GetMustacheTemplates())
                .Returns(templatesByTemplateName);

                _templateWriter = new TemplateWriter(_mustacheTemplateProvider);
            }
示例#2
0
        public TemplateWriter(IMustacheTemplateProvider mustacheTemplateProvider)
        {
            if (mustacheTemplateProvider == null)
            {
                throw new ArgumentNullException(nameof(mustacheTemplateProvider));
            }

            _templatesByTemplateName = new Lazy <IDictionary <string, string> >(mustacheTemplateProvider.GetMustacheTemplates);

            _stubbleRender = new Lazy <StubbleVisitorRenderer>(
                () => new StubbleBuilder()
                .Configure(
                    settings =>
            {
                settings.SetMaxRecursionDepth(512);
                settings.SetIgnoreCaseOnKeyLookup(true);
            }
                    )
                .Build());

            _renderSettings = new RenderSettings {
                SkipHtmlEncoding = true
            };
        }