Skip to content

Commit dfcb5b7

Browse files
committed
Add a test to ensure partially qualified references will be resolved correctly
1 parent 44d2277 commit dfcb5b7

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//--------------------------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by a tool.
4+
//
5+
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
6+
// </auto-generated>
7+
//--------------------------------------------------------------------------------------------------
8+
9+
namespace Processor
10+
{
11+
[global::System.CodeDom.Compiler.GeneratedCode("AutomaticInterface", "")]
12+
public partial interface IModelProcessor
13+
{
14+
/// <inheritdoc cref="Processor.ModelProcessor.Template" />
15+
global::ModelsRoot.Models.IModel Template { get; }
16+
17+
/// <inheritdoc cref="Processor.ModelProcessor.Process(Models.IModel)" />
18+
global::ModelsRoot.Models.IModel Process(global::ModelsRoot.Models.IModel model);
19+
20+
/// <inheritdoc cref="Processor.ModelProcessor.ModelChanged" />
21+
event EventHandler<global::ModelsRoot.Models.IModel> ModelChanged;
22+
23+
}
24+
}
25+
26+
27+
//--------------------------------------------------------------------------------------------------
28+
// <auto-generated>
29+
// This code was generated by a tool.
30+
//
31+
// Changes to this file may cause incorrect behavior and will be lost if the code is regenerated.
32+
// </auto-generated>
33+
//--------------------------------------------------------------------------------------------------
34+
35+
namespace ModelsRoot.Models
36+
{
37+
[global::System.CodeDom.Compiler.GeneratedCode("AutomaticInterface", "")]
38+
public partial interface IModel
39+
{
40+
}
41+
}

AutomaticInterface/Tests/TypeResolutions/TypeResolutions.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,38 @@ public class Model : IModel;
203203
await Verify(Infrastructure.GenerateCode(code));
204204
}
205205

206+
[Fact]
207+
public async Task WorksWithQualifiedGeneratedInterfaceReferences()
208+
{
209+
const string code = """
210+
using AutomaticInterface;
211+
212+
namespace Processor
213+
{
214+
using ModelsRoot;
215+
216+
[GenerateAutomaticInterface]
217+
public class ModelProcessor : IModelProcessor
218+
{
219+
public Models.IModel Process(Models.IModel model) => null;
220+
221+
public event EventHandler<Models.IModel> ModelChanged;
222+
223+
public Models.IModel Template => null;
224+
}
225+
}
226+
227+
namespace ModelsRoot.Models
228+
{
229+
230+
[GenerateAutomaticInterface]
231+
public class Model : IModel;
232+
}
233+
""";
234+
235+
await Verify(Infrastructure.GenerateCode(code));
236+
}
237+
206238
[Fact]
207239
public async Task WorksWithGeneratedGenericInterfaceReferences()
208240
{

0 commit comments

Comments
 (0)