AutoMapper
This commit is contained in:
@@ -23,9 +23,6 @@ namespace ProxyInterfaceSourceGenerator
|
||||
|
||||
public void Execute(GeneratorExecutionContext ctx)
|
||||
{
|
||||
var attributeData = _proxyAttributeGenerator.GenerateFile();
|
||||
ctx.AddSource(attributeData.FileName, SourceText.From(attributeData.Text, Encoding.UTF8));
|
||||
|
||||
if (ctx.SyntaxReceiver is not ProxySyntaxReceiver receiver)
|
||||
{
|
||||
return;
|
||||
@@ -37,6 +34,9 @@ namespace ProxyInterfaceSourceGenerator
|
||||
CandidateInterfaces = receiver.CandidateInterfaces
|
||||
};
|
||||
|
||||
var attributeData = _proxyAttributeGenerator.GenerateFile();
|
||||
context.GeneratorExecutionContext.AddSource(attributeData.FileName, SourceText.From(attributeData.Text, Encoding.UTF8));
|
||||
|
||||
var partialInterfacesGenerator = new PartialInterfacesGenerator(context);
|
||||
foreach (var data in partialInterfacesGenerator.GenerateFiles())
|
||||
{
|
||||
@@ -50,71 +50,4 @@ namespace ProxyInterfaceSourceGenerator
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct Test
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
public Clazz C { get; }
|
||||
|
||||
public int Add(string s)
|
||||
{
|
||||
return 600;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class Clazz
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
public interface ITest
|
||||
{
|
||||
int Id { get; set; }
|
||||
|
||||
IClazz C { get; }
|
||||
|
||||
int Add(string s);
|
||||
}
|
||||
|
||||
public interface IClazz
|
||||
{
|
||||
string Name { get; set; }
|
||||
}
|
||||
|
||||
public class TestMock : ITest
|
||||
{
|
||||
private Test _instance;
|
||||
|
||||
private IClazz _clazz;
|
||||
|
||||
public TestMock(Test instance)
|
||||
{
|
||||
_instance = instance;
|
||||
|
||||
_clazz = new ClazzMock(_instance.C);
|
||||
}
|
||||
|
||||
public int Id
|
||||
{
|
||||
get => _instance.Id;
|
||||
set => _instance.Id = value;
|
||||
}
|
||||
|
||||
public IClazz C => _clazz;
|
||||
|
||||
public int Add(string s) => _instance.Add(s);
|
||||
}
|
||||
|
||||
public class ClazzMock : IClazz
|
||||
{
|
||||
private Clazz _instance;
|
||||
|
||||
public ClazzMock(Clazz instance)
|
||||
{
|
||||
_instance = instance;
|
||||
}
|
||||
|
||||
public string Name { get => _instance.Name; set => _instance.Name = value; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user