11// Copyright (c) Microsoft Corporation.
22// Licensed under the MIT License.
33
4- // using Microsoft.Azure.Functions.Worker;
4+ using Microsoft . Azure . Functions . Worker ;
55using Microsoft . DurableTask . Generators . Tests . Utils ;
66
77namespace Microsoft . DurableTask . Generators . Tests ;
@@ -11,7 +11,7 @@ public class AzureFunctionsTests
1111 const string GeneratedClassName = "GeneratedDurableTaskExtensions" ;
1212 const string GeneratedFileName = $ "{ GeneratedClassName } .cs";
1313
14- [ Fact ( Skip = "Durable Functions Extension out of date" ) ]
14+ [ Fact ]
1515 public async Task Activities_SimpleFunctionTrigger ( )
1616 {
1717 string code = @"
@@ -40,7 +40,7 @@ await TestHelpers.RunTestAsync<DurableTaskSourceGenerator>(
4040 isDurableFunctions : true ) ;
4141 }
4242
43- [ Fact ( Skip = "Durable Functions Extension out of date" ) ]
43+ [ Fact ]
4444 public async Task Activities_SimpleFunctionTrigger_TaskReturning ( )
4545 {
4646 string code = @"
@@ -70,7 +70,7 @@ await TestHelpers.RunTestAsync<DurableTaskSourceGenerator>(
7070 isDurableFunctions : true ) ;
7171 }
7272
73- [ Fact ( Skip = "Durable Functions Extension out of date" ) ]
73+ [ Fact ]
7474 public async Task Activities_SimpleFunctionTrigger_CustomType ( )
7575 {
7676 string code = @"
@@ -111,7 +111,7 @@ await TestHelpers.RunTestAsync<DurableTaskSourceGenerator>(
111111 /// </summary>
112112 /// <param name="inputType">The activity input type.</param>
113113 /// <param name="outputType">The activity output type.</param>
114- [ Theory ( Skip = "Durable Functions Extension out of date" ) ]
114+ [ Theory ]
115115 [ InlineData ( "int" , "string" ) ]
116116 [ InlineData ( "string" , "int" ) ]
117117 [ InlineData ( "Guid" , "TimeSpan" ) ]
@@ -126,11 +126,18 @@ public async Task Activities_ClassBasedSyntax(string inputType, string outputTyp
126126using Microsoft.DurableTask;
127127
128128[DurableTask(nameof(MyActivity))]
129- public class MyActivity : TaskActivityBase <{ inputType } , { outputType } >
129+ public class MyActivity : TaskActivity <{ inputType } , { outputType } >
130130{{
131- protected override { outputType } OnRun (TaskActivityContext context, { inputType } input) => default!;
131+ public override Task< { outputType } > RunAsync (TaskActivityContext context, { inputType } input) => Task.FromResult< { outputType } >( default!) ;
132132}}" ;
133133
134+ // Build the expected InputParameter format (matches generator logic)
135+ string expectedInputParameter = inputType + " input" ;
136+ if ( inputType . EndsWith ( '?' ) )
137+ {
138+ expectedInputParameter += " = default" ;
139+ }
140+
134141 string expectedOutput = TestHelpers . WrapAndFormat (
135142 GeneratedClassName ,
136143 methodList : $@ "
@@ -140,9 +147,9 @@ public class MyActivity : TaskActivityBase<{inputType}, {outputType}>
140147}}
141148
142149[Function(nameof(MyActivity))]
143- public static async Task<{ outputType } > MyActivity([ActivityTrigger] { defaultInputType } input , string instanceId, FunctionContext executionContext)
150+ public static async Task<{ outputType } > MyActivity([ActivityTrigger] { expectedInputParameter } , string instanceId, FunctionContext executionContext)
144151{{
145- ITaskActivity activity = ActivatorUtilities.CreateInstance <MyActivity>(executionContext.InstanceServices);
152+ ITaskActivity activity = ActivatorUtilities.GetServiceOrCreateInstance <MyActivity>(executionContext.InstanceServices);
146153 TaskActivityContext context = new GeneratedActivityContext(""MyActivity"", instanceId);
147154 object? result = await activity.RunAsync(context, input);
148155 return ({ outputType } )result!;
@@ -164,7 +171,7 @@ await TestHelpers.RunTestAsync<DurableTaskSourceGenerator>(
164171 /// </summary>
165172 /// <param name="inputType">The activity input type.</param>
166173 /// <param name="outputType">The activity output type.</param>
167- [ Theory ( Skip = "Durable Functions Extension out of date" ) ]
174+ [ Theory ]
168175 [ InlineData ( "int" , "string?" ) ]
169176 [ InlineData ( "string" , "int" ) ]
170177 [ InlineData ( "(int, int)" , "(double, double)" ) ]
@@ -183,11 +190,18 @@ public async Task Orchestrators_ClassBasedSyntax(string inputType, string output
183190namespace MyNS
184191{{
185192 [DurableTask(nameof(MyOrchestrator))]
186- public class MyOrchestrator : TaskOrchestratorBase <{ inputType } , { outputType } >
193+ public class MyOrchestrator : TaskOrchestrator <{ inputType } , { outputType } >
187194 {{
188- protected override Task<{ outputType } > OnRunAsync (TaskOrchestrationContext ctx, { defaultInputType } input) => throw new NotImplementedException();
195+ public override Task<{ outputType } > RunAsync (TaskOrchestrationContext ctx, { defaultInputType } input) => throw new NotImplementedException();
189196 }}
190197}}" ;
198+ // Build the expected InputParameter format (matches generator logic)
199+ string expectedInputParameter = inputType + " input" ;
200+ if ( inputType . EndsWith ( '?' ) )
201+ {
202+ expectedInputParameter += " = default" ;
203+ }
204+
191205 string expectedOutput = TestHelpers . WrapAndFormat (
192206 GeneratedClassName ,
193207 methodList : $@ "
@@ -200,32 +214,18 @@ public class MyOrchestrator : TaskOrchestratorBase<{inputType}, {outputType}>
200214 .ContinueWith(t => ({ outputType } )(t.Result ?? default({ outputType } )!), TaskContinuationOptions.ExecuteSynchronously);
201215}}
202216
203- /// <inheritdoc cref=""DurableTaskClient .ScheduleNewOrchestrationInstanceAsync""/>
217+ /// <inheritdoc cref=""IOrchestrationSubmitter .ScheduleNewOrchestrationInstanceAsync""/>
204218public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
205- this DurableTaskClient client,
206- string? instanceId = null,
207- { defaultInputType } input = default,
208- DateTimeOffset? startTime = null)
219+ this IOrchestrationSubmitter client, { expectedInputParameter } , StartOrchestrationOptions? options = null)
209220{{
210- return client.ScheduleNewOrchestrationInstanceAsync(
211- ""MyOrchestrator"",
212- instanceId,
213- input,
214- startTime);
221+ return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options);
215222}}
216223
217- /// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync""/>
224+ /// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync(TaskName, object?, TaskOptions?) ""/>
218225public static Task<{ outputType } > CallMyOrchestratorAsync(
219- this TaskOrchestrationContext context,
220- string? instanceId = null,
221- { defaultInputType } input = default,
222- TaskOptions? options = null)
226+ this TaskOrchestrationContext context, { expectedInputParameter } , TaskOptions? options = null)
223227{{
224- return context.CallSubOrchestratorAsync<{ outputType } >(
225- ""MyOrchestrator"",
226- instanceId,
227- input,
228- options);
228+ return context.CallSubOrchestratorAsync<{ outputType } >(""MyOrchestrator"", input, options);
229229}}" ,
230230 isDurableFunctions : true ) ;
231231
@@ -243,7 +243,7 @@ await TestHelpers.RunTestAsync<DurableTaskSourceGenerator>(
243243 /// </summary>
244244 /// <param name="inputType">The activity input type.</param>
245245 /// <param name="outputType">The activity output type.</param>
246- [ Theory ( Skip = "Durable Functions Extension out of date" ) ]
246+ [ Theory ]
247247 [ InlineData ( "int" , "string?" ) ]
248248 [ InlineData ( "string" , "int" ) ]
249249 [ InlineData ( "(int, int)" , "(double, double)" ) ]
@@ -264,14 +264,21 @@ namespace MyNS
264264 [DurableTask]
265265 public class MyOrchestrator : MyOrchestratorBase
266266 {{
267- protected override Task<{ outputType } > OnRunAsync (TaskOrchestrationContext ctx, { defaultInputType } input) => throw new NotImplementedException();
267+ public override Task<{ outputType } > RunAsync (TaskOrchestrationContext ctx, { defaultInputType } input) => throw new NotImplementedException();
268268 }}
269269
270- public abstract class MyOrchestratorBase : TaskOrchestratorBase <{ inputType } , { outputType } >
270+ public abstract class MyOrchestratorBase : TaskOrchestrator <{ inputType } , { outputType } >
271271 {{
272272 }}
273273}}" ;
274274 // Same output as Orchestrators_ClassBasedSyntax
275+ // Build the expected InputParameter format (matches generator logic)
276+ string expectedInputParameter = inputType + " input" ;
277+ if ( inputType . EndsWith ( '?' ) )
278+ {
279+ expectedInputParameter += " = default" ;
280+ }
281+
275282 string expectedOutput = TestHelpers . WrapAndFormat (
276283 GeneratedClassName ,
277284 methodList : $@ "
@@ -284,32 +291,18 @@ public abstract class MyOrchestratorBase : TaskOrchestratorBase<{inputType}, {ou
284291 .ContinueWith(t => ({ outputType } )(t.Result ?? default({ outputType } )!), TaskContinuationOptions.ExecuteSynchronously);
285292}}
286293
287- /// <inheritdoc cref=""DurableTaskClient .ScheduleNewOrchestrationInstanceAsync""/>
294+ /// <inheritdoc cref=""IOrchestrationSubmitter .ScheduleNewOrchestrationInstanceAsync""/>
288295public static Task<string> ScheduleNewMyOrchestratorInstanceAsync(
289- this DurableTaskClient client,
290- string? instanceId = null,
291- { defaultInputType } input = default,
292- DateTimeOffset? startTime = null)
296+ this IOrchestrationSubmitter client, { expectedInputParameter } , StartOrchestrationOptions? options = null)
293297{{
294- return client.ScheduleNewOrchestrationInstanceAsync(
295- ""MyOrchestrator"",
296- instanceId,
297- input,
298- startTime);
298+ return client.ScheduleNewOrchestrationInstanceAsync(""MyOrchestrator"", input, options);
299299}}
300300
301- /// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync""/>
301+ /// <inheritdoc cref=""TaskOrchestrationContext.CallSubOrchestratorAsync(TaskName, object?, TaskOptions?) ""/>
302302public static Task<{ outputType } > CallMyOrchestratorAsync(
303- this TaskOrchestrationContext context,
304- string? instanceId = null,
305- { defaultInputType } input = default,
306- TaskOptions? options = null)
303+ this TaskOrchestrationContext context, { expectedInputParameter } , TaskOptions? options = null)
307304{{
308- return context.CallSubOrchestratorAsync<{ outputType } >(
309- ""MyOrchestrator"",
310- instanceId,
311- input,
312- options);
305+ return context.CallSubOrchestratorAsync<{ outputType } >(""MyOrchestrator"", input, options);
313306}}" ,
314307 isDurableFunctions : true ) ;
315308
0 commit comments