diff --git a/starsky/starskytest/starsky.foundation.storage/Storage/StorageThumbnailFilesystemTest.cs b/starsky/starskytest/starsky.foundation.storage/Storage/StorageThumbnailFilesystemTest.cs index b49197dea..377b23620 100644 --- a/starsky/starskytest/starsky.foundation.storage/Storage/StorageThumbnailFilesystemTest.cs +++ b/starsky/starskytest/starsky.foundation.storage/Storage/StorageThumbnailFilesystemTest.cs @@ -1,3 +1,4 @@ +using System; using System.IO; using System.Threading.Tasks; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -178,4 +179,67 @@ public void IsFileReady_thumbnailStorage() Assert.IsFalse(_thumbnailStorage.ExistFile(thumbnailId)); } + + [TestMethod] + public void IsFolderOrFile() + { + Assert.ThrowsException(() => + _thumbnailStorage.IsFolderOrFile("not-found")); + } + + [TestMethod] + public void FolderMove() + { + Assert.ThrowsException(() => + _thumbnailStorage.FolderMove("not-found", "2")); + } + + [TestMethod] + public void CreateDirectory() + { + Assert.ThrowsException(() => + _thumbnailStorage.CreateDirectory("not-found")); + } + + [TestMethod] + public void FolderDelete() + { + Assert.ThrowsException(() => + _thumbnailStorage.FolderDelete("not-found")); + } + + [TestMethod] + public void GetAllFilesInDirectoryRecursive() + { + Assert.ThrowsException(() => + _thumbnailStorage.GetAllFilesInDirectoryRecursive("not-found")); + } + + [TestMethod] + public void GetDirectories() + { + Assert.ThrowsException(() => + _thumbnailStorage.GetDirectories("not-found")); + } + + [TestMethod] + public void GetDirectoryRecursive() + { + Assert.ThrowsException(() => + _thumbnailStorage.GetDirectoryRecursive("not-found")); + } + + [TestMethod] + public void ReadStream_NotFound() + { + Assert.ThrowsException(() => + _thumbnailStorage.ReadStream("not-found")); + } + + [TestMethod] + public void WriteStreamOpenOrCreate() + { + Assert.ThrowsException(() => + _thumbnailStorage.WriteStreamOpenOrCreate(Stream.Null, "not-found")); + } } diff --git a/starsky/starskytest/starsky.foundation.video/Process/FfmpegStreamToStreamRunnerTests.cs b/starsky/starskytest/starsky.foundation.video/Process/FfmpegStreamToStreamRunnerTests.cs index caa33a13d..931ac7af1 100644 --- a/starsky/starskytest/starsky.foundation.video/Process/FfmpegStreamToStreamRunnerTests.cs +++ b/starsky/starskytest/starsky.foundation.video/Process/FfmpegStreamToStreamRunnerTests.cs @@ -19,22 +19,26 @@ namespace starskytest.starsky.foundation.video.Process; public class FfmpegStreamToStreamRunnerTests { private readonly string _ffmpegExe; + private readonly string _ffmpegExePosix; + private readonly string _ffmpegExeWindows; private readonly StorageHostFullPathFilesystem _hostFullPathFilesystem; private readonly string _readFile; public FfmpegStreamToStreamRunnerTests() { _hostFullPathFilesystem = new StorageHostFullPathFilesystem(new FakeIWebLogger()); - if ( new AppSettings().IsWindows ) - { - _ffmpegExe = new CreateAnImage().BasePath + "ffmpeg.exe"; - } - else - { - _ffmpegExe = new CreateAnImage().BasePath + "ffmpeg"; - } + _hostFullPathFilesystem.CreateDirectory(Path.Combine(new CreateAnImage().BasePath, + "FfmpegStreamToStreamRunnerTests")); + + _ffmpegExeWindows = Path.Combine(new CreateAnImage().BasePath, + "FfmpegStreamToStreamRunnerTests", "ffmpeg.exe"); + _ffmpegExePosix = Path.Combine(new CreateAnImage().BasePath, + "FfmpegStreamToStreamRunnerTests", "ffmpeg"); + + _ffmpegExe = new AppSettings().IsWindows ? _ffmpegExeWindows : _ffmpegExePosix; - _readFile = new CreateAnImage().BasePath + "read_file"; + _readFile = Path.Combine(new CreateAnImage().BasePath, + "FfmpegStreamToStreamRunnerTests", "read_file"); } private void CreateStubFile(string path, string content) @@ -50,27 +54,30 @@ private async Task SetupFakeFfmpegExecutable() new CreateAnZipfileFakeFfMpeg().Bytes ]); - CreateStubFile(new CreateAnImage().BasePath + "ffmpeg", + CreateStubFile(_ffmpegExePosix, "#!/bin/bash\necho Fake Executable"); CreateStubFile(_readFile, "test_content"); var ffmpegExe = new MemoryStream(zipper.FirstOrDefault(p => p.Key == "ffmpeg.exe").Value); await _hostFullPathFilesystem.WriteStreamAsync(ffmpegExe, - new CreateAnImage().BasePath + "ffmpeg.exe"); + _ffmpegExeWindows); await new FfMpegChmod(new FakeSelectorStorage(_hostFullPathFilesystem), new FakeIWebLogger()) .Chmod( - new CreateAnImage().BasePath + "ffmpeg"); + _ffmpegExePosix); } [ClassCleanup] public static void CleanUp() { - File.Delete(new CreateAnImage().BasePath + "ffmpeg"); - File.Delete(new CreateAnImage().BasePath + "ffmpeg.exe"); - File.Delete(new CreateAnImage().BasePath + "read_file"); + File.Delete(Path.Combine(new CreateAnImage().BasePath, "FfmpegStreamToStreamRunnerTests", + "ffmpeg")); + File.Delete(Path.Combine(new CreateAnImage().BasePath, "FfmpegStreamToStreamRunnerTests", + "ffmpeg.exe")); + File.Delete(Path.Combine(new CreateAnImage().BasePath, "FfmpegStreamToStreamRunnerTests", + "read_file")); } [TestMethod] @@ -102,7 +109,7 @@ public async Task RunProcessAsync_ExitCode() await SetupFakeFfmpegExecutable(); // overwrite the file with a bash script that will exit with code 1 - CreateStubFile(new CreateAnImage().BasePath + "ffmpeg", + CreateStubFile(_ffmpegExePosix, "#!/bin/bash\ntest_content\n exit 1"); var file = new StorageHostFullPathFilesystem(new FakeIWebLogger()).ReadStream(_readFile);