public void GivenNullEmptyOrWhitespaceString_WhenCallingSplitIntoLines_ThenReturnsNull(string text) { //arrange //act var response = _classUnderTest.SplitIntoLines(text); //assert response.Should().BeNull(); }
private async Task <ImportAssetsRequest> CreateSaveAssetRegisterFileRequest(IList <IFormFile> files) { var memoryStream = new MemoryStream(); await files[0].CopyToAsync(memoryStream, _backgroundProcessor.GetCancellationToken()).ConfigureAwait(false); var text = Encoding.UTF8.GetString(memoryStream.GetBuffer()); var assetLines = _textSplitter.SplitIntoLines(text); var importAssetsRequest = new ImportAssetsRequest { Delimiter = ";", AssetLines = assetLines, FileName = files[0]?.FileName }; return(importAssetsRequest); }
public async Task <IList <AssetOutputModel> > ProcessAsync(string[] args) { ValidateConsoleInput(args); var parsedInput = _inputParser.Parse(args); var cancellationTokenSource = new CancellationTokenSource(); var text = await _fileReader.ReadAsync(parsedInput.FilePath, cancellationTokenSource.Token).ConfigureAwait(false); var csvLines = _textSplitter.SplitIntoLines(text); var importAssetsRequest = new ImportAssetsRequest { Delimiter = parsedInput.Delimiter, AssetLines = csvLines }; var response = await _importAssetsUseCase.ExecuteAsync(importAssetsRequest, cancellationTokenSource.Token).ConfigureAwait(false); return(response?.AssetsImported); }