diff --git a/AutomaticInterface/AutomaticInterface/InterfaceBuilder.cs b/AutomaticInterface/AutomaticInterface/InterfaceBuilder.cs index 654a129..11c191f 100644 --- a/AutomaticInterface/AutomaticInterface/InterfaceBuilder.cs +++ b/AutomaticInterface/AutomaticInterface/InterfaceBuilder.cs @@ -104,7 +104,9 @@ public string Build() cb.AppendLine( "[global::System.CodeDom.Compiler.GeneratedCode(\"AutomaticInterface\", \"\")]" ); - cb.AppendLine($"{(asInternal ? "internal" : "public")} partial interface {interfaceName}{genericType}"); + cb.AppendLine( + $"{(asInternal ? "internal" : "public")} partial interface {interfaceName}{genericType}" + ); cb.AppendLine("{"); cb.Indent(); diff --git a/AutomaticInterface/AutomaticInterface/RegisterAttributesExtensions.cs b/AutomaticInterface/AutomaticInterface/RegisterAttributesExtensions.cs index c10df77..ee637db 100644 --- a/AutomaticInterface/AutomaticInterface/RegisterAttributesExtensions.cs +++ b/AutomaticInterface/AutomaticInterface/RegisterAttributesExtensions.cs @@ -27,6 +27,8 @@ namespace AutomaticInterface /// Namespace name for the generated interface. Defaults to the same namespace as the class. /// Interface name for the generated interface. Defaults to an interface version of the class name. [AttributeUsage(AttributeTargets.Class)] + [global::System.CodeDom.Compiler.GeneratedCode("AutomaticInterface", "")] + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] internal sealed class {{{AutomaticInterfaceGenerator.DefaultAttributeName}}}Attribute : Attribute { internal {{{AutomaticInterfaceGenerator.DefaultAttributeName}}}Attribute(string {{{AutomaticInterfaceGenerator.NamespaceParameterName}}} = "", string {{{AutomaticInterfaceGenerator.InterfaceParameterName}}} = "", bool asInternal = false) { } @@ -59,6 +61,8 @@ namespace AutomaticInterface /// Ignore this member in a generated Interface from this class /// [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event)] + [global::System.CodeDom.Compiler.GeneratedCode("AutomaticInterface", "")] + [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage] internal sealed class {{{AutomaticInterfaceGenerator.IgnoreAutomaticInterfaceAttributeName}}}Attribute : Attribute { internal {{{AutomaticInterfaceGenerator.IgnoreAutomaticInterfaceAttributeName}}}Attribute() { } diff --git a/AutomaticInterface/Tests/Misc/Misc.cs b/AutomaticInterface/Tests/Misc/Misc.cs index a49a7f3..d1b0677 100644 --- a/AutomaticInterface/Tests/Misc/Misc.cs +++ b/AutomaticInterface/Tests/Misc/Misc.cs @@ -366,8 +366,8 @@ class DemoClass } [Fact] - public async Task AsInternal() - { + public async Task AsInternal() + { const string code = """ using AutomaticInterface; @@ -381,13 +381,13 @@ public string AMethod(DemoClass? x, string y) } } - """; + """; await Verify(Infrastructure.GenerateCode(code)); - } - + } + [Fact] - public async Task AsInternalExplicitFalse() - { + public async Task AsInternalExplicitFalse() + { const string code = """ using AutomaticInterface; @@ -401,7 +401,7 @@ public string AMethod(DemoClass? x, string y) } } - """; + """; await Verify(Infrastructure.GenerateCode(code)); } }