@@ -168,6 +168,92 @@ public System.Threading.Tasks.Task TestMethod()
168168 await CreateTest ( originalSource , "Test.TestActorClient.g.cs" , generatedSource ) . RunAsync ( ) ;
169169 }
170170
171+ [ Fact ]
172+ public async Task TestSingleGenericInternalInterface ( )
173+ {
174+ var originalSource = @"
175+ using Dapr.Actors.Generators;
176+ using System.Threading.Tasks;
177+
178+ namespace Test
179+ {
180+ [GenerateActorClient]
181+ internal interface ITestActor<TGenericType>
182+ {
183+ Task TestMethod();
184+ }
185+ }" ;
186+
187+ var generatedSource = @"// <auto-generated/>
188+ #nullable enable
189+ namespace Test
190+ {
191+ internal sealed class TestActorClient<TGenericType> : Test.ITestActor<TGenericType>
192+ {
193+ private readonly Dapr.Actors.Client.ActorProxy actorProxy;
194+ public TestActorClient(Dapr.Actors.Client.ActorProxy actorProxy)
195+ {
196+ if (actorProxy is null)
197+ {
198+ throw new System.ArgumentNullException(nameof(actorProxy));
199+ }
200+
201+ this.actorProxy = actorProxy;
202+ }
203+
204+ public System.Threading.Tasks.Task TestMethod()
205+ {
206+ return this.actorProxy.InvokeMethodAsync(""TestMethod"");
207+ }
208+ }
209+ }" ;
210+
211+ await CreateTest ( originalSource , "Test.TestActorClient.g.cs" , generatedSource ) . RunAsync ( ) ;
212+ }
213+
214+ [ Fact ]
215+ public async Task TestMultipleGenericsInternalInterface ( )
216+ {
217+ var originalSource = @"
218+ using Dapr.Actors.Generators;
219+ using System.Threading.Tasks;
220+
221+ namespace Test
222+ {
223+ [GenerateActorClient]
224+ internal interface ITestActor<TGenericType1, TGenericType2>
225+ {
226+ Task TestMethod();
227+ }
228+ }" ;
229+
230+ var generatedSource = @"// <auto-generated/>
231+ #nullable enable
232+ namespace Test
233+ {
234+ internal sealed class TestActorClient<TGenericType1, TGenericType2> : Test.ITestActor<TGenericType1, TGenericType2>
235+ {
236+ private readonly Dapr.Actors.Client.ActorProxy actorProxy;
237+ public TestActorClient(Dapr.Actors.Client.ActorProxy actorProxy)
238+ {
239+ if (actorProxy is null)
240+ {
241+ throw new System.ArgumentNullException(nameof(actorProxy));
242+ }
243+
244+ this.actorProxy = actorProxy;
245+ }
246+
247+ public System.Threading.Tasks.Task TestMethod()
248+ {
249+ return this.actorProxy.InvokeMethodAsync(""TestMethod"");
250+ }
251+ }
252+ }" ;
253+
254+ await CreateTest ( originalSource , "Test.TestActorClient.g.cs" , generatedSource ) . RunAsync ( ) ;
255+ }
256+
171257 [ Fact ]
172258 public async Task TestRenamedClient ( )
173259 {
@@ -211,6 +297,92 @@ public System.Threading.Tasks.Task TestMethod()
211297 await CreateTest ( originalSource , "Test.MyTestActorClient.g.cs" , generatedSource ) . RunAsync ( ) ;
212298 }
213299
300+ [ Fact ]
301+ public async Task TestSingleGenericRenamedClient ( )
302+ {
303+ var originalSource = @"
304+ using Dapr.Actors.Generators;
305+ using System.Threading.Tasks;
306+
307+ namespace Test
308+ {
309+ [GenerateActorClient(Name = ""MyTestActorClient"")]
310+ internal interface ITestActor<TGenericType>
311+ {
312+ Task TestMethod();
313+ }
314+ }" ;
315+
316+ var generatedSource = @"// <auto-generated/>
317+ #nullable enable
318+ namespace Test
319+ {
320+ internal sealed class MyTestActorClient<TGenericType> : Test.ITestActor<TGenericType>
321+ {
322+ private readonly Dapr.Actors.Client.ActorProxy actorProxy;
323+ public MyTestActorClient(Dapr.Actors.Client.ActorProxy actorProxy)
324+ {
325+ if (actorProxy is null)
326+ {
327+ throw new System.ArgumentNullException(nameof(actorProxy));
328+ }
329+
330+ this.actorProxy = actorProxy;
331+ }
332+
333+ public System.Threading.Tasks.Task TestMethod()
334+ {
335+ return this.actorProxy.InvokeMethodAsync(""TestMethod"");
336+ }
337+ }
338+ }" ;
339+
340+ await CreateTest ( originalSource , "Test.MyTestActorClient.g.cs" , generatedSource ) . RunAsync ( ) ;
341+ }
342+
343+ [ Fact ]
344+ public async Task TestMultipleGenericsRenamedClient ( )
345+ {
346+ var originalSource = @"
347+ using Dapr.Actors.Generators;
348+ using System.Threading.Tasks;
349+
350+ namespace Test
351+ {
352+ [GenerateActorClient(Name = ""MyTestActorClient"")]
353+ internal interface ITestActor<TGenericType1, TGenericType2>
354+ {
355+ Task TestMethod();
356+ }
357+ }" ;
358+
359+ var generatedSource = @"// <auto-generated/>
360+ #nullable enable
361+ namespace Test
362+ {
363+ internal sealed class MyTestActorClient<TGenericType1, TGenericType2> : Test.ITestActor<TGenericType1, TGenericType2>
364+ {
365+ private readonly Dapr.Actors.Client.ActorProxy actorProxy;
366+ public MyTestActorClient(Dapr.Actors.Client.ActorProxy actorProxy)
367+ {
368+ if (actorProxy is null)
369+ {
370+ throw new System.ArgumentNullException(nameof(actorProxy));
371+ }
372+
373+ this.actorProxy = actorProxy;
374+ }
375+
376+ public System.Threading.Tasks.Task TestMethod()
377+ {
378+ return this.actorProxy.InvokeMethodAsync(""TestMethod"");
379+ }
380+ }
381+ }" ;
382+
383+ await CreateTest ( originalSource , "Test.MyTestActorClient.g.cs" , generatedSource ) . RunAsync ( ) ;
384+ }
385+
214386 [ Fact ]
215387 public async Task TestCustomNamespace ( )
216388 {
0 commit comments