public override IEnumerable <ITheoryDatum> GetDataSets() { const string @namespace = "RecordGeneratorTests"; const string typeName = "Person"; yield return(new GeneratorTheoryData { Description = "new string property", SourcePackage = new GeneratorSourcePackage { OldSource = @" namespace RecordGeneratorTests { [Record] partial class Person { public string FirstName { get; } public string LastName { get; } } }", AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace), @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName) { this.FirstName = FirstName; } public Person WithFirstName(string FirstName) { return new Person (FirstName); } } }".ReplaceRecordGeneratorVersion(Properties.VersionString) }, ChangedSource = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName, string LastName) { this.FirstName = FirstName; this.LastName = LastName; } public Person WithFirstName(string FirstName) { return new Person (FirstName, LastName); } public Person WithLastName(string LastName) { return new Person (FirstName, LastName); } } }".ReplaceRecordGeneratorVersion(Properties.VersionString) }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialInvalidDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 19) } } } }); yield return(new GeneratorTheoryData { Description = "renamed property", SourcePackage = new GeneratorSourcePackage { OldSource = @" namespace RecordGeneratorTests { [Record] partial class Person { public string FirstName { get; } public string LastName { get; } } }", AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace), @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName, string SecondName) { this.FirstName = FirstName; this.SecondName = SecondName; } public Person WithFirstName(string FirstName) { return new Person (FirstName, SecondName); } public Person WithSecondName(string SecondName) { return new Person (FirstName, SecondName); } }".ReplaceRecordGeneratorVersion(Properties.VersionString) }, ChangedSource = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName, string LastName) { this.FirstName = FirstName; this.LastName = LastName; } public Person WithFirstName(string FirstName) { return new Person (FirstName, LastName); } public Person WithLastName(string LastName) { return new Person (FirstName, LastName); } } }".ReplaceRecordGeneratorVersion(Properties.VersionString) }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialInvalidDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 19) } } } }); yield return(new GeneratorTheoryData { Description = "removed property", SourcePackage = new GeneratorSourcePackage { OldSource = @" namespace RecordGeneratorTests { [Record] partial class Person { public string FirstName { get; } } }", AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace), @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName, string SecondName) { this.FirstName = FirstName; this.SecondName = SecondName; } public Person WithFirstName(string FirstName) { return new Person (FirstName, SecondName); } public Person WithSecondName(string SecondName) { return new Person (FirstName, SecondName); } }".ReplaceRecordGeneratorVersion(Properties.VersionString) }, ChangedSource = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName) { this.FirstName = FirstName; } public Person WithFirstName(string FirstName) { return new Person (FirstName); } } }".ReplaceRecordGeneratorVersion(Properties.VersionString) }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialInvalidDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 19) } } } }); yield return(new GeneratorTheoryData { Description = "property type changed", SourcePackage = new GeneratorSourcePackage { OldSource = @" namespace RecordGeneratorTests { [Record] partial class Person { public string FirstName { get; } public int LastName { get; } } }", AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace), @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName, string LastName) { this.FirstName = FirstName; this.LastName = LastName; } public Person WithFirstName(string FirstName) { return new Person (FirstName, LastName); } public Person WithLastName(string LastName) { return new Person (FirstName, LastName); } }".ReplaceRecordGeneratorVersion(Properties.VersionString) }, ChangedSource = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName, int LastName) { this.FirstName = FirstName; this.LastName = LastName; } public Person WithFirstName(string FirstName) { return new Person (FirstName, LastName); } public Person WithLastName(int LastName) { return new Person (FirstName, LastName); } } }".ReplaceRecordGeneratorVersion(Properties.VersionString) }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialInvalidDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 19) } } } }); }
public override IEnumerable <ITheoryDatum> GetDataSets() { const string @namespace = "RecordGeneratorTests"; const string typeName = "Person"; yield return(new GeneratorTheoryData { Description = "basic string properties", SourcePackage = new GeneratorSourcePackage { OldSource = @" namespace RecordGeneratorTests { [Record] partial class Person { public string FirstName { get; } public string LastName { get; } } }", AddedSource = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName, string LastName) { this.FirstName = FirstName; this.LastName = LastName; } public Person WithFirstName(string FirstName) { return new Person (FirstName, LastName); } public Person WithLastName(string LastName) { return new Person (FirstName, LastName); } } }".ReplaceRecordGeneratorVersion(Properties.VersionString), AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) } }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 19) } } } }); yield return(new GeneratorTheoryData { Description = "no partial in original", SourcePackage = new GeneratorSourcePackage { OldSource = @" namespace RecordGeneratorTests { [Record] class Person { public string FirstName { get; } public string LastName { get; } } }", FixedSource = @" namespace RecordGeneratorTests { [Record] partial class Person { public string FirstName { get; } public string LastName { get; } } }", AddedSource = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName, string LastName) { this.FirstName = FirstName; this.LastName = LastName; } public Person WithFirstName(string FirstName) { return new Person (FirstName, LastName); } public Person WithLastName(string LastName) { return new Person (FirstName, LastName); } } }".ReplaceRecordGeneratorVersion(Properties.VersionString), AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) } }, ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 11) } } } }); yield return(new GeneratorTheoryData { Description = "multiple (also type-parametrized) properties", SourcePackage = new GeneratorSourcePackage { OldSource = @" namespace RecordGeneratorTests { [Record] partial class Person<T> { public T OtherProperty { get; } public string FirstName { get; } public string LastName { get; } public string Address { get; } public DateTime Birthday { get; } } }", AddedSource = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person<T> { public Person(T OtherProperty, string FirstName, string LastName, string Address, DateTime Birthday) { this.OtherProperty = OtherProperty; this.FirstName = FirstName; this.LastName = LastName; this.Address = Address; this.Birthday = Birthday; } public Person<T> WithOtherProperty(T OtherProperty) { return new Person<T>(OtherProperty, FirstName, LastName, Address, Birthday); } public Person<T> WithFirstName(string FirstName) { return new Person<T>(OtherProperty, FirstName, LastName, Address, Birthday); } public Person<T> WithLastName(string LastName) { return new Person<T>(OtherProperty, FirstName, LastName, Address, Birthday); } public Person<T> WithAddress(string Address) { return new Person<T>(OtherProperty, FirstName, LastName, Address, Birthday); } public Person<T> WithBirthday(DateTime Birthday) { return new Person<T>(OtherProperty, FirstName, LastName, Address, Birthday); } } }".ReplaceRecordGeneratorVersion(Properties.VersionString), AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) } }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 19) } } } }); yield return(new GeneratorTheoryData { Description = "nested namespaces, usings", SourcePackage = new GeneratorSourcePackage { OldSource = @" using System; using System.Linq; namespace RecordGeneratorTests { namespace Outer { using SomethingInner; namespace Inner.InnerMost { [Record] partial class Person { public string FirstName { get; } } } } }", AddedSource = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again using System; using System.Linq; namespace RecordGeneratorTests { namespace Outer { using SomethingInner; namespace Inner.InnerMost { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName) { this.FirstName = FirstName; } public Person WithFirstName(string FirstName) { return new Person (FirstName); } } } } }".ReplaceRecordGeneratorVersion(Properties.VersionString), AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) } }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 14, 27) } } } }); yield return (new GeneratorTheoryData { Description = "nested types", SourcePackage = new GeneratorSourcePackage { OldSource = @" namespace RecordGeneratorTests { partial class Outer { partial class Inner<T> { [Record] partial class Person { public string FirstName { get; } } } } }", FixedSource = @" namespace RecordGeneratorTests { partial class Outer { partial class Inner<T> { [Record] partial class Person { public string FirstName { get; } } } } }", AddedSource = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { partial class Outer { partial class Inner<T> { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName) { this.FirstName = FirstName; } public Person WithFirstName(string FirstName) { return new Person (FirstName); } } } } }".ReplaceRecordGeneratorVersion(Properties.VersionString), AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) } }, ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 9, 27) } } } }); yield return(new GeneratorTheoryData { Description = "ctor access protected", SourcePackage = new GeneratorSourcePackage { OldSource = @" namespace RecordGeneratorTests { [Record(PrimaryCtorAccess = ""protected"")] partial class Person { public string FirstName { get; } public string LastName { get; } } }", AddedSource = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { protected Person(string FirstName, string LastName) { this.FirstName = FirstName; this.LastName = LastName; } public Person WithFirstName(string FirstName) { return new Person (FirstName, LastName); } public Person WithLastName(string LastName) { return new Person (FirstName, LastName); } } }".ReplaceRecordGeneratorVersion(Properties.VersionString), AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) } }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 19) } } } }); yield return(new GeneratorTheoryData { Description = "ctor access private", SourcePackage = new GeneratorSourcePackage { OldSource = @" namespace RecordGeneratorTests { [Record(PrimaryCtorAccess = ""private"")] partial class Person { public string FirstName { get; } public string LastName { get; } } }", AddedSource = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { private Person(string FirstName, string LastName) { this.FirstName = FirstName; this.LastName = LastName; } public Person WithFirstName(string FirstName) { return new Person (FirstName, LastName); } public Person WithLastName(string LastName) { return new Person (FirstName, LastName); } } }".ReplaceRecordGeneratorVersion(Properties.VersionString), AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) } }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 19) } } } }); yield return(new GeneratorTheoryData { Description = "ctor access explicit public", SourcePackage = new GeneratorSourcePackage { OldSource = @" namespace RecordGeneratorTests { [Record(PrimaryCtorAccess = ""public"")] partial class Person { public string FirstName { get; } public string LastName { get; } } }", AddedSource = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName, string LastName) { this.FirstName = FirstName; this.LastName = LastName; } public Person WithFirstName(string FirstName) { return new Person (FirstName, LastName); } public Person WithLastName(string LastName) { return new Person (FirstName, LastName); } } }".ReplaceRecordGeneratorVersion(Properties.VersionString), AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) } }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 19) } } } }); yield return(new GeneratorTheoryData { Description = "no mutators", SourcePackage = new GeneratorSourcePackage { OldSource = @" namespace RecordGeneratorTests { [Record(GenerateMutators = false)] partial class Person { public string FirstName { get; } public string LastName { get; } } }", AddedSource = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName, string LastName) { this.FirstName = FirstName; this.LastName = LastName; } } }".ReplaceRecordGeneratorVersion(Properties.VersionString), AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) } }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 19) } } } }); }
public override IEnumerable <ITheoryDatum> GetDataSets() { var oldVersion = "0.0.123.456"; var newVersion = Properties.VersionString; const string @namespace = "RecordGeneratorTests"; const string typeName = "Person"; var source = @" namespace RecordGeneratorTests { [Record] partial class Person { public string FirstName { get; } public string LastName { get; } } }"; var partial = @"// Record partial generated by RecordGenerator // WARNING any changes made to this file will be lost when generator is run again namespace RecordGeneratorTests { [System.CodeDom.Compiler.GeneratedCode(""RecordGenerator"", ""GENERATOR_VERSION"")] partial class Person { public Person(string FirstName, string LastName) { this.FirstName = FirstName; this.LastName = LastName; } public Person WithFirstName(string FirstName) { return new Person (FirstName, LastName); } public Person WithLastName(string LastName) { return new Person (FirstName, LastName); } } }"; yield return(new GeneratorTheoryData { Description = "same version", SourcePackage = new GeneratorSourcePackage { OldSource = source, AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace), partial.ReplaceRecordGeneratorVersion(newVersion) } }.AndFixedSameAsOld(), ExpectedDiagnostics = new DiagnosticResult[] { } }); yield return(new GeneratorTheoryData { Description = "different version", SourcePackage = new GeneratorSourcePackage { OldSource = source, AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace), partial.ReplaceRecordGeneratorVersion(oldVersion) }, ChangedSource = partial.ReplaceRecordGeneratorVersion(newVersion) }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(GeneratorVersionDifferentDiagnostic.Descriptor, typeName, oldVersion, newVersion) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 19) } } } }); }
public override IEnumerable <ITheoryDatum> GetDataSets() { const string @namespace = "ConsoleApplication1"; const string typeName = "TypeName"; yield return(new GeneratorTheoryData { Description = "class with [Record]", SourcePackage = new GeneratorSourcePackage { OldSource = GetBasicClassDeclaration(typeName, @namespace, "Record"), AddedSource = GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordAttributeDeclarationMissingDiagnostic.Descriptor, typeName, "Record") { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 4, 10) } }, new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 15) } } } }); yield return(new GeneratorTheoryData { Description = "class with [record]", SourcePackage = new GeneratorSourcePackage { OldSource = GetBasicClassDeclaration(typeName, @namespace, "record"), AddedSource = GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordAttributeDeclarationMissingDiagnostic.Descriptor, typeName, "record") { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 4, 10) } }, new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 15) } } } }); yield return(new GeneratorTheoryData { Description = "struct with [Record]", SourcePackage = new GeneratorSourcePackage { OldSource = GetBasicStructDeclaration(typeName, @namespace, "Record"), AddedSource = GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordAttributeDeclarationMissingDiagnostic.Descriptor, typeName, "Record") { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 4, 10) } }, new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 16) } } } }); yield return(new GeneratorTheoryData { Description = "struct with [record]", SourcePackage = new GeneratorSourcePackage { OldSource = GetBasicStructDeclaration(typeName, @namespace, "record"), AddedSource = GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordAttributeDeclarationMissingDiagnostic.Descriptor, typeName, "record") { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 4, 10) } }, new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 16) } } } }); yield return(new GeneratorTheoryData { Description = "interface with [Record] - no diagnostics expected", SourcePackage = new GeneratorSourcePackage { OldSource = GetBasicInterfaceDeclaration(typeName, @namespace, "Record"), }.AndFixedSameAsOld(), ExpectedDiagnostics = new DiagnosticResult[] { } }); yield return(new GeneratorTheoryData { Description = "attribute exists, only diagnostic to create record partial expected", SourcePackage = new GeneratorSourcePackage { OldSource = GetBasicClassDeclaration(typeName, @namespace, "Record"), AdditionalSources = new[] { GenerateRecordAttributeDeclarationCodeFixProvider.RecordAttributeDeclarationSource(@namespace) } }.AndFixedSameAsOld(), ExpectedDiagnostics = new[] { new DiagnosticResult(RecordPartialMissingDiagnostic.Descriptor, typeName) { Locations = new[] { new DiagnosticResultLocation("Test0.cs", 5, 15) } } } }); }