@@ -12,27 +12,27 @@ namespace Microsoft.DurableTask.ScheduledTasks.Tests.Client;
1212
1313public class ScheduleClientImplTests
1414{
15- readonly Mock < DurableTaskClient > durableTaskClientMock ;
16- readonly Mock < ILogger > loggerMock ;
17- readonly Mock < DurableEntityClient > entityClientMock ;
15+ readonly Mock < DurableTaskClient > durableTaskClient ;
16+ readonly Mock < DurableEntityClient > entityClient ;
17+ readonly Mock < ILogger > logger ;
1818 readonly ScheduleClientImpl client ;
1919 readonly string scheduleId = "test-schedule" ;
2020
2121 public ScheduleClientImplTests ( )
2222 {
23- this . durableTaskClientMock = new Mock < DurableTaskClient > ( ) ;
24- this . loggerMock = new Mock < ILogger > ( ) ;
25- this . entityClientMock = new Mock < DurableEntityClient > ( ) ;
26- this . durableTaskClientMock . Setup ( c => c . Entities ) . Returns ( this . entityClientMock . Object ) ;
27- this . client = new ScheduleClientImpl ( this . durableTaskClientMock . Object , this . scheduleId , this . loggerMock . Object ) ;
23+ this . durableTaskClient = new Mock < DurableTaskClient > ( "test" , MockBehavior . Strict ) ;
24+ this . entityClient = new Mock < DurableEntityClient > ( "test" , MockBehavior . Strict ) ;
25+ this . logger = new Mock < ILogger > ( MockBehavior . Loose ) ;
26+ this . durableTaskClient . Setup ( x => x . Entities ) . Returns ( this . entityClient . Object ) ;
27+ this . client = new ScheduleClientImpl ( this . durableTaskClient . Object , this . scheduleId , this . logger . Object ) ;
2828 }
2929
3030 [ Fact ]
3131 public void Constructor_WithNullClient_ThrowsArgumentNullException ( )
3232 {
3333 // Act & Assert
3434 var ex = Assert . Throws < ArgumentNullException > ( ( ) =>
35- new ScheduleClientImpl ( null ! , this . scheduleId , this . loggerMock . Object ) ) ;
35+ new ScheduleClientImpl ( null ! , this . scheduleId , this . logger . Object ) ) ;
3636 Assert . Equal ( "client" , ex . ParamName ) ;
3737 }
3838
@@ -43,7 +43,7 @@ public void Constructor_WithInvalidScheduleId_ThrowsArgumentException(string inv
4343 {
4444 // Act & Assert
4545 var ex = Assert . Throws < ArgumentException > ( ( ) =>
46- new ScheduleClientImpl ( this . durableTaskClientMock . Object , invalidScheduleId , this . loggerMock . Object ) ) ;
46+ new ScheduleClientImpl ( this . durableTaskClient . Object , invalidScheduleId , this . logger . Object ) ) ;
4747 Assert . Contains ( "scheduleId cannot be null or empty" , ex . Message , StringComparison . OrdinalIgnoreCase ) ;
4848 }
4949
@@ -52,7 +52,7 @@ public void Constructor_WithNullLogger_ThrowsArgumentNullException()
5252 {
5353 // Act & Assert
5454 var ex = Assert . Throws < ArgumentNullException > ( ( ) =>
55- new ScheduleClientImpl ( this . durableTaskClientMock . Object , this . scheduleId , null ! ) ) ;
55+ new ScheduleClientImpl ( this . durableTaskClient . Object , this . scheduleId , null ! ) ) ;
5656 Assert . Equal ( "logger" , ex . ParamName ) ;
5757 }
5858
@@ -66,7 +66,7 @@ public async Task DescribeAsync_WhenExists_ReturnsDescription()
6666 ScheduleConfiguration = new ScheduleConfiguration ( this . scheduleId , "test-orchestration" , TimeSpan . FromMinutes ( 5 ) )
6767 } ;
6868
69- this . entityClientMock
69+ this . entityClient
7070 . Setup ( c => c . GetEntityAsync < ScheduleState > (
7171 It . Is < EntityInstanceId > ( id => id . Name == nameof ( Schedule ) && id . Key == this . scheduleId ) ,
7272 It . IsAny < CancellationToken > ( ) ) )
@@ -86,7 +86,7 @@ public async Task DescribeAsync_WhenExists_ReturnsDescription()
8686 public async Task DescribeAsync_WhenNotExists_ThrowsScheduleNotFoundException ( )
8787 {
8888 // Arrange
89- this . entityClientMock
89+ this . entityClient
9090 . Setup ( c => c . GetEntityAsync < ScheduleState > (
9191 It . Is < EntityInstanceId > ( id => id . Name == nameof ( Schedule ) && id . Key == this . scheduleId ) ,
9292 It . IsAny < CancellationToken > ( ) ) )
@@ -103,22 +103,22 @@ public async Task DeleteAsync_ExecutesDeleteOperation()
103103 // Arrange
104104 string instanceId = "test-instance" ;
105105
106- this . durableTaskClientMock
106+ this . durableTaskClient
107107 . Setup ( c => c . ScheduleNewOrchestrationInstanceAsync (
108108 It . Is < TaskName > ( n => n . Name == nameof ( ExecuteScheduleOperationOrchestrator ) ) ,
109109 It . IsAny < ScheduleOperationRequest > ( ) ,
110110 It . IsAny < CancellationToken > ( ) ) )
111111 . ReturnsAsync ( instanceId ) ;
112112
113- this . durableTaskClientMock
113+ this . durableTaskClient
114114 . Setup ( c => c . WaitForInstanceCompletionAsync ( instanceId , true , It . IsAny < CancellationToken > ( ) ) )
115115 . ReturnsAsync ( new OrchestrationMetadata ( nameof ( ExecuteScheduleOperationOrchestrator ) , instanceId ) ) ;
116116
117117 // Act
118118 await this . client . DeleteAsync ( ) ;
119119
120120 // Assert
121- this . durableTaskClientMock . Verify (
121+ this . durableTaskClient . Verify (
122122 c => c . ScheduleNewOrchestrationInstanceAsync (
123123 It . Is < TaskName > ( n => n . Name == nameof ( ExecuteScheduleOperationOrchestrator ) ) ,
124124 It . Is < ScheduleOperationRequest > ( r =>
@@ -135,22 +135,22 @@ public async Task PauseAsync_ExecutesPauseOperation()
135135 // Arrange
136136 string instanceId = "test-instance" ;
137137
138- this . durableTaskClientMock
138+ this . durableTaskClient
139139 . Setup ( c => c . ScheduleNewOrchestrationInstanceAsync (
140140 It . Is < TaskName > ( n => n . Name == nameof ( ExecuteScheduleOperationOrchestrator ) ) ,
141141 It . IsAny < ScheduleOperationRequest > ( ) ,
142142 It . IsAny < CancellationToken > ( ) ) )
143143 . ReturnsAsync ( instanceId ) ;
144144
145- this . durableTaskClientMock
145+ this . durableTaskClient
146146 . Setup ( c => c . WaitForInstanceCompletionAsync ( instanceId , true , It . IsAny < CancellationToken > ( ) ) )
147147 . ReturnsAsync ( new OrchestrationMetadata ( nameof ( ExecuteScheduleOperationOrchestrator ) , instanceId ) ) ;
148148
149149 // Act
150150 await this . client . PauseAsync ( ) ;
151151
152152 // Assert
153- this . durableTaskClientMock . Verify (
153+ this . durableTaskClient . Verify (
154154 c => c . ScheduleNewOrchestrationInstanceAsync (
155155 It . Is < TaskName > ( n => n . Name == nameof ( ExecuteScheduleOperationOrchestrator ) ) ,
156156 It . Is < ScheduleOperationRequest > ( r =>
@@ -167,22 +167,22 @@ public async Task ResumeAsync_ExecutesResumeOperation()
167167 // Arrange
168168 string instanceId = "test-instance" ;
169169
170- this . durableTaskClientMock
170+ this . durableTaskClient
171171 . Setup ( c => c . ScheduleNewOrchestrationInstanceAsync (
172172 It . Is < TaskName > ( n => n . Name == nameof ( ExecuteScheduleOperationOrchestrator ) ) ,
173173 It . IsAny < ScheduleOperationRequest > ( ) ,
174174 It . IsAny < CancellationToken > ( ) ) )
175175 . ReturnsAsync ( instanceId ) ;
176176
177- this . durableTaskClientMock
177+ this . durableTaskClient
178178 . Setup ( c => c . WaitForInstanceCompletionAsync ( instanceId , true , It . IsAny < CancellationToken > ( ) ) )
179179 . ReturnsAsync ( new OrchestrationMetadata ( nameof ( ExecuteScheduleOperationOrchestrator ) , instanceId ) ) ;
180180
181181 // Act
182182 await this . client . ResumeAsync ( ) ;
183183
184184 // Assert
185- this . durableTaskClientMock . Verify (
185+ this . durableTaskClient . Verify (
186186 c => c . ScheduleNewOrchestrationInstanceAsync (
187187 It . Is < TaskName > ( n => n . Name == nameof ( ExecuteScheduleOperationOrchestrator ) ) ,
188188 It . Is < ScheduleOperationRequest > ( r =>
@@ -204,22 +204,22 @@ public async Task UpdateAsync_ExecutesUpdateOperation()
204204 Interval = TimeSpan . FromMinutes ( 10 )
205205 } ;
206206
207- this . durableTaskClientMock
207+ this . durableTaskClient
208208 . Setup ( c => c . ScheduleNewOrchestrationInstanceAsync (
209209 It . Is < TaskName > ( n => n . Name == nameof ( ExecuteScheduleOperationOrchestrator ) ) ,
210210 It . IsAny < ScheduleOperationRequest > ( ) ,
211211 It . IsAny < CancellationToken > ( ) ) )
212212 . ReturnsAsync ( instanceId ) ;
213213
214- this . durableTaskClientMock
214+ this . durableTaskClient
215215 . Setup ( c => c . WaitForInstanceCompletionAsync ( instanceId , true , It . IsAny < CancellationToken > ( ) ) )
216216 . ReturnsAsync ( new OrchestrationMetadata ( nameof ( ExecuteScheduleOperationOrchestrator ) , instanceId ) ) ;
217217
218218 // Act
219219 await this . client . UpdateAsync ( updateOptions ) ;
220220
221221 // Assert
222- this . durableTaskClientMock . Verify (
222+ this . durableTaskClient . Verify (
223223 c => c . ScheduleNewOrchestrationInstanceAsync (
224224 It . Is < TaskName > ( n => n . Name == nameof ( ExecuteScheduleOperationOrchestrator ) ) ,
225225 It . Is < ScheduleOperationRequest > ( r =>
0 commit comments