public async Task StartTrainingFailsWithInvalidPrefix()
        {
            var client           = CreateFormTrainingClient();
            var trainingFilesUri = new Uri(TestEnvironment.BlobContainerSasUrl);

            var filter = new TrainingFileFilter {
                IncludeSubFolders = true, Prefix = "invalidPrefix"
            };
            TrainingOperation operation = await client.StartTrainingAsync(trainingFilesUri, useTrainingLabels : false, filter);

            Assert.ThrowsAsync <RequestFailedException>(async() => await operation.WaitForCompletionAsync(PollingInterval));
        }
        public async Task StartTrainingSucceedsWithValidPrefix()
        {
            var client           = CreateFormTrainingClient();
            var trainingFilesUri = new Uri(TestEnvironment.BlobContainerSasUrl);

            var filter = new TrainingFileFilter {
                IncludeSubFolders = true, Prefix = "subfolder"
            };
            TrainingOperation operation = await client.StartTrainingAsync(trainingFilesUri, useTrainingLabels : false, filter);

            await operation.WaitForCompletionAsync(PollingInterval);

            Assert.IsTrue(operation.HasValue);
            Assert.AreEqual(CustomFormModelStatus.Ready, operation.Value.Status);
        }
Example #3
0
        public async Task StartTrainingFailsWithInvalidPrefix()
        {
            var client           = CreateFormTrainingClient();
            var trainingFilesUri = new Uri(TestEnvironment.BlobContainerSasUrlV2);

            var filter = new TrainingFileFilter {
                IncludeSubfolders = true, Prefix = "invalidPrefix"
            };
            TrainingOperation operation = await client.StartTrainingAsync(trainingFilesUri, useTrainingLabels : false, new TrainingOptions()
            {
                TrainingFileFilter = filter
            });

            RequestFailedException ex = Assert.ThrowsAsync <RequestFailedException>(async() => await operation.WaitForCompletionAsync());

            Assert.AreEqual("2014", ex.ErrorCode);
        }
Example #4
0
 internal TrainRequest_internal(string source, TrainingFileFilter sourceFilter, bool?useLabelFile)
 {
     Source       = source;
     SourceFilter = sourceFilter;
     UseLabelFile = useLabelFile;
 }