public void TestNoAttribute() { // simply ignore var source = @" class C { } "; var generatorDiagnostics = GeneratorTestFactory.RunGenerator(source); Assert.False(generatorDiagnostics.Any(x => x.Severity == DiagnosticSeverity.Error)); }
public void GeneratesEmptyInterface() { var source = @" using AutomaticInterfaceAttribute; namespace AutomaticInterfaceExample { [GenerateAutomaticInterface] class DemoClass { } } "; var generatorDiagnostics = GeneratorTestFactory.RunGenerator(source); Assert.False(generatorDiagnostics.Any(x => x.Severity == DiagnosticSeverity.Error)); }
public void GeneratesStringPropertySetOnlyInterface() { var source = @" using AutomaticInterfaceAttribute; namespace AutomaticInterfaceExample { [GenerateAutomaticInterface] class DemoClass { string _hello; public string Hello { set => _hello = value; } } } "; var generatorDiagnostics = GeneratorTestFactory.RunGenerator(source); Assert.False(generatorDiagnostics.Any(x => x.Severity == DiagnosticSeverity.Error), string.Join("\n", generatorDiagnostics)); }