@@ -36,7 +36,7 @@ public async Task EmptyOrchestration()
3636 }
3737
3838 [ Fact ]
39- public async Task ScheduleOrchesrationWithTags ( )
39+ public async Task ScheduleOrchestrationWithTags ( )
4040 {
4141 TaskName orchestratorName = nameof ( EmptyOrchestration ) ;
4242 await using HostTestLifetime server = await this . StartWorkerAsync ( b =>
@@ -67,6 +67,52 @@ public async Task ScheduleOrchesrationWithTags()
6767 Assert . Equal ( "value2" , metadata . Tags [ "tag2" ] ) ;
6868 }
6969
70+ [ Fact ]
71+ public async Task ScheduleSubOrchestrationWithTags ( )
72+ {
73+ TaskName orchestratorName = nameof ( ScheduleSubOrchestrationWithTags ) ;
74+
75+ // Schedule a new orchestration instance with tags
76+ SubOrchestrationOptions subOrchestrationOptions = new ( )
77+ {
78+ InstanceId = "instance_id" ,
79+ Tags = new Dictionary < string , string >
80+ {
81+ { "tag1" , "value1" } ,
82+ { "tag2" , "value2" }
83+ }
84+ } ;
85+
86+ await using HostTestLifetime server = await this . StartWorkerAsync ( b =>
87+ {
88+ b . AddTasks ( tasks => tasks . AddOrchestratorFunc < int , int > ( orchestratorName , async ( ctx , input ) =>
89+ {
90+ int result = 1 ;
91+ if ( input < 2 )
92+ {
93+ // recursively call this same orchestrator
94+ result += await ctx . CallSubOrchestratorAsync < int > ( orchestratorName , input : input + 1 , subOrchestrationOptions ) ;
95+ }
96+
97+ return result ;
98+ } ) ) ;
99+ } ) ;
100+
101+
102+ await server . Client . ScheduleNewOrchestrationInstanceAsync ( orchestratorName , input : 1 ) ;
103+
104+ OrchestrationMetadata metadata = await server . Client . WaitForInstanceCompletionAsync (
105+ subOrchestrationOptions . InstanceId , this . TimeoutToken ) ;
106+
107+ Assert . NotNull ( metadata ) ;
108+ Assert . Equal ( subOrchestrationOptions . InstanceId , metadata . InstanceId ) ;
109+ Assert . Equal ( OrchestrationRuntimeStatus . Completed , metadata . RuntimeStatus ) ;
110+ Assert . NotNull ( metadata . Tags ) ;
111+ Assert . Equal ( 2 , metadata . Tags . Count ) ;
112+ Assert . Equal ( "value1" , metadata . Tags [ "tag1" ] ) ;
113+ Assert . Equal ( "value2" , metadata . Tags [ "tag2" ] ) ;
114+ }
115+
70116 [ Fact ]
71117 public async Task SingleTimer ( )
72118 {
0 commit comments