public async Task AddImage_should_create_if_folder_absent()
        {
            var fileSystem = new MockFileSystem();

            _cache = new DirectoryImageCache(_folderPath, 2, fileSystem);
            fileSystem.Directory.Exists(_folderPath).Should().BeFalse();

            using (var s = new MemoryStream())
            {
                await _cache.AddImageAsync("file", s);
            }

            fileSystem.Directory.Exists(_folderPath).Should().BeTrue();
        }
        public async Task AddImage_should_create_image_from_stream()
        {
            var currentFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var folderPath    = Path.Combine(currentFolder, "Images");

            using (var imageStream = new MemoryStream())
            {
                var fileSystem = new FileSystem();
                Resources.User.Save(imageStream, ImageFormat.Png);
                imageStream.Position = 0;

                _cache = new DirectoryImageCache(folderPath, 2, fileSystem);
                fileSystem.Directory.Exists(_folderPath).Should().BeFalse();

                await _cache.AddImageAsync("file.png", imageStream);

                fileSystem.Directory.Exists(folderPath).Should().BeTrue();
                fileSystem.File.Exists(Path.Combine(folderPath, "file.png")).Should().BeTrue();
            }
        }
        public async Task AddImage_should_raise_invalidate()
        {
            var currentFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var folderPath    = Path.Combine(currentFolder, "Images");

            using (var imageStream = new MemoryStream())
            {
                var fileSystem = new FileSystem();
                Resources.User.Save(imageStream, ImageFormat.Png);
                imageStream.Position = 0;

                bool eventRaised = false;
                _cache              = new DirectoryImageCache(folderPath, 2, fileSystem);
                _cache.Invalidated += (s, e) => eventRaised = true;

                await _cache.AddImageAsync("file.png", imageStream);

                eventRaised.Should().BeTrue();
            }
        }
        public async Task AddImage_should_exit_if_stream_null()
        {
            await _cache.AddImageAsync("file", null);

            _directory.DidNotReceive().Exists(_folderPath);
        }