public void WriteRazorCompiledItemAttribute_RendersCorrectly()
    {
        // Arrange
        var extension = new MetadataAttributeTargetExtension()
        {
            CompiledItemAttributeName = "global::TestItem",
        };
        var context = TestCodeRenderingContext.CreateRuntime();

        var node = new RazorCompiledItemAttributeIntermediateNode()
        {
            TypeName   = "Foo.Bar",
            Kind       = "test",
            Identifier = "Foo/Bar",
        };

        // Act
        extension.WriteRazorCompiledItemAttribute(context, node);

        // Assert
        var csharp = context.CodeWriter.GenerateCode();

        Assert.Equal(
            @"[assembly: global::TestItem(typeof(Foo.Bar), @""test"", @""Foo/Bar"")]
",
            csharp,
            ignoreLineEndingDifferences: true);
    }
    public void WriteRazorCompiledItemAttribute(CodeRenderingContext context, RazorCompiledItemAttributeIntermediateNode node)
    {
        if (context == null)
        {
            throw new ArgumentNullException(nameof(context));
        }

        if (node == null)
        {
            throw new ArgumentNullException(nameof(node));
        }

        // [assembly: global::...RazorCompiledItem(typeof({node.TypeName}), @"{node.Kind}", @"{node.Identifier}")]
        context.CodeWriter.Write("[assembly: ");
        context.CodeWriter.Write(CompiledItemAttributeName);
        context.CodeWriter.Write("(typeof(");
        context.CodeWriter.Write(node.TypeName);
        context.CodeWriter.Write("), @\"");
        context.CodeWriter.Write(node.Kind);
        context.CodeWriter.Write("\", @\"");
        context.CodeWriter.Write(node.Identifier);
        context.CodeWriter.WriteLine("\")]");
    }