Пример #1
0
        public async Task GetAndListOperationsWithTags()
        {
            var client           = CreateDocumentModelAdministrationClient();
            var trainingFilesUri = new Uri(TestEnvironment.BlobContainerSasUrl);
            var modelId          = Recording.GenerateId();
            var options          = new BuildModelOptions();

            foreach (var tag in TestingTags)
            {
                options.Tags.Add(tag);
            }

            BuildModelOperation operation = await client.StartBuildModelAsync(trainingFilesUri, DocumentBuildMode.Template, modelId, options);

            ModelOperationInfo modelOperationInfo = client.GetOperationsAsync().ToEnumerableAsync().Result
                                                    .FirstOrDefault(op => op.OperationId == operation.Id);

            Assert.NotNull(modelOperationInfo);

            CollectionAssert.AreEquivalent(TestingTags, modelOperationInfo.Tags);

            ModelOperation modelOperation = await client.GetOperationAsync(operation.Id);

            CollectionAssert.AreEquivalent(TestingTags, modelOperation.Tags);

            await client.DeleteModelAsync(modelId);
        }
Пример #2
0
 private void ValidateModelOperationInfo(ModelOperationInfo model)
 {
     Assert.NotNull(model.OperationId);
     Assert.NotNull(model.Status);
     Assert.AreNotEqual(new DateTimeOffset(), model.CreatedOn);
     Assert.AreNotEqual(new DateTimeOffset(), model.LastUpdatedOn);
     Assert.NotNull(model.Kind);
     Assert.NotNull(model.ResourceLocation);
     if (model.Status == DocumentOperationStatus.Succeeded)
     {
         Assert.NotNull(model.PercentCompleted);
         Assert.AreEqual(100, model.PercentCompleted);
     }
 }