Пример #1
0
        public void ReturnUnchangedNormalString()
        {
            string input = "this is a normal string without template values";

            var template = _templateGenerator.CompileTemplate(input);

            Assert.Equal(template(null), input);
        }
    public void GeneratedCodeIsUpToDate()
    {
        var currentContentPath = Path.Combine(AppContext.BaseDirectory, "Shared", "GeneratedContent", "RouteHandlerInvocationContextOfT.Generated.cs");
        var templatePath       = Path.Combine(AppContext.BaseDirectory, "Shared", "GeneratedContent", "RouteHandlerInvocationContextOfT.Generated.tt");

        var generator        = new TemplateGenerator();
        var compiledTemplate = generator.CompileTemplate(File.ReadAllText(templatePath));

        var generatedContent = compiledTemplate.Process();
        var currentContent   = File.ReadAllText(currentContentPath);

        Assert.Equal(currentContent, generatedContent);
    }