private async Task <string> ProcessFile(string tempFile, string tempDirectory, CancellationToken ct) { try { var compressed = await _compressionService.Compress(tempFile, tempDirectory, ct); var compressedFilePath = Path.Combine(tempDirectory, compressed); var uploadedFilePath = _uploadService.UploadFile(tempDirectory, compressedFilePath); return(uploadedFilePath); } catch (Exception) { CleanUp(tempDirectory); throw; } }
public async Task Consume_FileCompressed_and_UploadFileSended() { // Arrange var testFileName = "test.webm"; var directory = nameof(Consume_FileCompressed_and_UploadFileSended); Directory.CreateDirectory(directory); MoveTestFile(directory, testFileName); // Act var file = await _service.Compress(testFileName, directory, default); // Assert Assert.True(File.Exists(Path.Combine(directory, file))); }