@@ -34,9 +34,52 @@ public async Task AnalyzeDocumentOperationCanParseOperationId(WaitUntil waitUnti
3434 var options = new AnalyzeDocumentOptions ( "prebuilt-receipt" , uriSource ) ;
3535
3636 Operation < AnalyzeResult > operation = await client . AnalyzeDocumentAsync ( waitUntil , options ) ;
37- await operation . WaitForCompletionAsync ( ) ;
37+ string operationId = operation . Id ;
3838
39- var match = Regex . Match ( operation . Id , AnalysisOperationIdPattern ) ;
39+ var match = Regex . Match ( operationId , AnalysisOperationIdPattern ) ;
40+
41+ Assert . That ( match . Success ) ;
42+ }
43+
44+ [ RecordedTest ]
45+ [ TestCase ( WaitUntil . Started ) ]
46+ [ TestCase ( WaitUntil . Completed ) ]
47+ public async Task AnalyzeBatchDocumentsOperationCanParseOperationId ( WaitUntil waitUntil )
48+ {
49+ var client = CreateDocumentIntelligenceClient ( ) ;
50+
51+ var sourceContainerUri = new Uri ( TestEnvironment . BatchSourceBlobSasUrl ) ;
52+ var resultContainerUri = new Uri ( TestEnvironment . BatchResultBlobSasUrl ) ;
53+ var blobSource = new BlobContentSource ( sourceContainerUri ) ;
54+ var options = new AnalyzeBatchDocumentsOptions ( "prebuilt-read" , blobSource , resultContainerUri )
55+ {
56+ OverwriteExisting = true
57+ } ;
58+
59+ var operation = await client . AnalyzeBatchDocumentsAsync ( waitUntil , options ) ;
60+ string operationId = operation . Id ;
61+
62+ var match = Regex . Match ( operationId , AnalysisOperationIdPattern ) ;
63+
64+ Assert . That ( match . Success ) ;
65+ }
66+
67+ [ RecordedTest ]
68+ [ TestCase ( WaitUntil . Started ) ]
69+ [ TestCase ( WaitUntil . Completed ) ]
70+ public async Task ClassifyDocumentOperationCanParseOperationId ( WaitUntil waitUntil )
71+ {
72+ var client = CreateDocumentIntelligenceClient ( ) ;
73+
74+ await using var disposableClassifier = await BuildDisposableDocumentClassifierAsync ( ) ;
75+
76+ var uriSource = DocumentIntelligenceTestEnvironment . CreateUri ( TestFile . Irs1040 ) ;
77+ var options = new ClassifyDocumentOptions ( disposableClassifier . ClassifierId , uriSource ) ;
78+
79+ var operation = await client . ClassifyDocumentAsync ( waitUntil , options ) ;
80+ string operationId = operation . Id ;
81+
82+ var match = Regex . Match ( operationId , AnalysisOperationIdPattern ) ;
4083
4184 Assert . That ( match . Success ) ;
4285 }
@@ -54,10 +97,13 @@ public async Task BuildDocumentModelOperationCanParseOperationId(WaitUntil waitU
5497 var options = new BuildDocumentModelOptions ( modelId , DocumentBuildMode . Template , source ) ;
5598
5699 Operation < DocumentModelDetails > operation = null ;
100+ string operationId = null ;
57101
58102 try
59103 {
60104 operation = await client . BuildDocumentModelAsync ( waitUntil , options ) ;
105+ operationId = operation . Id ;
106+
61107 await operation . WaitForCompletionAsync ( ) ;
62108 }
63109 finally
@@ -68,7 +114,7 @@ public async Task BuildDocumentModelOperationCanParseOperationId(WaitUntil waitU
68114 }
69115 }
70116
71- var match = Regex . Match ( operation . Id , TrainingOperationIdPattern ) ;
117+ var match = Regex . Match ( operationId , TrainingOperationIdPattern ) ;
72118
73119 Assert . That ( match . Success ) ;
74120 }
@@ -88,10 +134,13 @@ public async Task CopyModelToOperationCanParseOperationId(WaitUntil waitUntil)
88134 ModelCopyAuthorization copyAuthorization = await client . AuthorizeModelCopyAsync ( authorizeCopyOptions ) ;
89135
90136 Operation < DocumentModelDetails > operation = null ;
137+ string operationId = null ;
91138
92139 try
93140 {
94141 operation = await client . CopyModelToAsync ( waitUntil , disposableModel . ModelId , copyAuthorization ) ;
142+ operationId = operation . Id ;
143+
95144 await operation . WaitForCompletionAsync ( ) ;
96145 }
97146 finally
@@ -102,7 +151,7 @@ public async Task CopyModelToOperationCanParseOperationId(WaitUntil waitUntil)
102151 }
103152 }
104153
105- var match = Regex . Match ( operation . Id , TrainingOperationIdPattern ) ;
154+ var match = Regex . Match ( operationId , TrainingOperationIdPattern ) ;
106155
107156 Assert . That ( match . Success ) ;
108157 }
@@ -129,10 +178,13 @@ public async Task ComposeModelOperationCanParseOperationId(WaitUntil waitUntil)
129178 var options = new ComposeModelOptions ( modelId , disposableClassifier . ClassifierId , docTypes ) ;
130179
131180 Operation < DocumentModelDetails > operation = null ;
181+ string operationId = null ;
132182
133183 try
134184 {
135185 operation = await client . ComposeModelAsync ( waitUntil , options ) ;
186+ operationId = operation . Id ;
187+
136188 await operation . WaitForCompletionAsync ( ) ;
137189 }
138190 finally
@@ -143,7 +195,7 @@ public async Task ComposeModelOperationCanParseOperationId(WaitUntil waitUntil)
143195 }
144196 }
145197
146- var match = Regex . Match ( operation . Id , TrainingOperationIdPattern ) ;
198+ var match = Regex . Match ( operationId , TrainingOperationIdPattern ) ;
147199
148200 Assert . That ( match . Success ) ;
149201 }
@@ -170,10 +222,13 @@ public async Task BuildClassifierOperationCanParseOperationId(WaitUntil waitUnti
170222 var options = new BuildClassifierOptions ( classifierId , docTypes ) ;
171223
172224 Operation < DocumentClassifierDetails > operation = null ;
225+ string operationId = null ;
173226
174227 try
175228 {
176229 operation = await client . BuildClassifierAsync ( waitUntil , options ) ;
230+ operationId = operation . Id ;
231+
177232 await operation . WaitForCompletionAsync ( ) ;
178233 }
179234 finally
@@ -184,7 +239,7 @@ public async Task BuildClassifierOperationCanParseOperationId(WaitUntil waitUnti
184239 }
185240 }
186241
187- var match = Regex . Match ( operation . Id , TrainingOperationIdPattern ) ;
242+ var match = Regex . Match ( operationId , TrainingOperationIdPattern ) ;
188243
189244 Assert . That ( match . Success ) ;
190245 }
@@ -204,10 +259,13 @@ public async Task CopyClassifierToOperationCanParseOperationId(WaitUntil waitUnt
204259 ClassifierCopyAuthorization copyAuthorization = await client . AuthorizeClassifierCopyAsync ( authorizeCopyOptions ) ;
205260
206261 Operation < DocumentClassifierDetails > operation = null ;
262+ string operationId = null ;
207263
208264 try
209265 {
210266 operation = await client . CopyClassifierToAsync ( waitUntil , disposableClassifier . ClassifierId , copyAuthorization ) ;
267+ operationId = operation . Id ;
268+
211269 await operation . WaitForCompletionAsync ( ) ;
212270 }
213271 finally
@@ -218,7 +276,7 @@ public async Task CopyClassifierToOperationCanParseOperationId(WaitUntil waitUnt
218276 }
219277 }
220278
221- var match = Regex . Match ( operation . Id , TrainingOperationIdPattern ) ;
279+ var match = Regex . Match ( operationId , TrainingOperationIdPattern ) ;
222280
223281 Assert . That ( match . Success ) ;
224282 }
0 commit comments