public void GivenNoRawResult_WhenInvokingExecute_ThenArgumentNullExceptionIsThrown() { //Arrange Action action = () => _target.Execute(null, 100, 100); //Act //Assert action.ShouldThrow <ArgumentNullException>() .WithMessage("Value cannot be null.\r\nParameter name: ocrOutput"); }
private async Task <AzureOcrResult> DoOcr(Stream imageAsStream, FileFormatEnum fileFormatEnum, DateTime start) { try { var preprocessedResult = _ocrPreProcessing.AjustOrientationAndSize(imageAsStream, fileFormatEnum); using (var stream = preprocessedResult.ImageFileStream) { ValidateImageProportions(preprocessedResult.NewImageHeight, preprocessedResult.NewImageWidth); var rawAzureOcrResult = await _azureVisionApi.Execute(stream); var content = _azureOcrParser.Execute(rawAzureOcrResult, preprocessedResult.NewImageHeight, preprocessedResult.NewImageWidth); return(AzureOcrResult.CreateSuccesResult(DateTime.Now.Subtract(start), content, rawAzureOcrResult)); } } catch (Exception e) { return(AzureOcrResult.CreateErrorResult(DateTime.Now.Subtract(start), e)); } }