public void RunBatchTestTest(List <TestingExample> examples, BatchTestingOutput expectedResponse) { var service = new BatchTestingService(); var batchTestResponse = service.RunBatchTest(examples, null, null); var mappedBatchTestResponse = BatchTestingOutputMapper.MapEvaluationOutput(batchTestResponse); Assert.Equal(expectedResponse, mappedBatchTestResponse, new BatchTestingOutputComparer()); }
public async Task EvaluateCustomTextAppAsync(StorageType sourceStorageType, StorageType destinationStorageType) { InitializeStorage(sourceStorageType, destinationStorageType); // init result containers var convertedFiles = new ConcurrentBag <string>(); var failedFiles = new ConcurrentDictionary <string, string>(); // map app models to nuget classes var customTextModels = await _customTextAuthoringService.GetApplicationModels(); var mappedEntities = BatchTestingInputMapper.MapCustomTextAppEntityModels(customTextModels.Models, entityPrefix: string.Empty); var mappedClasses = BatchTestingInputMapper.MapCustomTextAppClassModels(customTextModels.Models); // get labeled examples _loggerService.LogOperation(OperationType.GeneratingTestSet); var labeledExamples = await _customTextAuthoringService.GetLabeledExamples(); var mappedTestData = await CreateTestData(labeledExamples, convertedFiles, failedFiles); // evaluate model _loggerService.LogOperation(OperationType.EvaluatingResults); var batchTestResponse = _batchTestingService.RunBatchTest(mappedTestData, mappedEntities, mappedClasses); // map output data var mappedBatchTestResponse = BatchTestingOutputMapper.MapEvaluationOutput(batchTestResponse); // store file var outFileName = Constants.CustomTextEvaluationControllerOutputFileName; _loggerService.LogOperation(OperationType.StoringResult, outFileName); var responseAsJson = JsonConvert.SerializeObject(mappedBatchTestResponse, Formatting.Indented); await _destinationStorageService.StoreDataAsync(responseAsJson, outFileName); // log result _loggerService.LogParsingResult(convertedFiles, failedFiles); }