I'm trying to write a source generator to remove boilerplate code in a project. The purpose of the project is to transpile existing unit tests of "solution" code to unit tests of "exercise" code. I'll give a short example below:
// The "solution" code
public void Name_InitializesAsNull() {
Solutions.Person person = new Solutions.Person();
Assert.IsNull(person.Name);
}
// The "exercise" code
public void Name_InitializesAsNull() {
Exercises.Person person = new Exercise.Person();
Assert.IsNull(person.Name);
}
In order to make this transpilation, I want to validate that the class Exercises.Person has a readable field or a property Name. I have previously done this through reflection, and would like to continue to do so.
So my question is: Is it possible to access type information, like MemberInfo, during source generation of types in the assemblies specified by CSharpCompilation.ExternalReferences?
Aucun commentaire:
Enregistrer un commentaire