namespace ImageSharp.Tests { using System; using System.IO; using ImageSharp; using Processing; using System.Collections.Generic; using ImageSharp.Formats; using ImageSharp.IO; /// /// Watches but does not actually run the processors against the image. /// /// public class SaveWatchingImage : Image { public List Saves { get; } = new List(); public SaveWatchingImage(int width, int height, IFileSystem fs = null) : base(width, height, Configuration.CreateDefaultInstance()) { //switch out the file system for tests this.Configuration.FileSystem = fs ?? this.Configuration.FileSystem; } internal override void SaveInternal(Stream stream, IImageEncoder encoder, IEncoderOptions options) { this.Saves.Add(new OperationDetails { encoder = encoder, options = options, stream = stream }); } public struct OperationDetails { public Stream stream; public IImageEncoder encoder; public IEncoderOptions options; } } }