// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using System.Reflection; namespace SixLabors.ImageSharp.Tests; /// /// Triggers passing instances which read an image from the given file /// One instance will be passed for each the pixel format defined by the pixelTypes parameter /// public class WithFileAttribute : ImageDataAttributeBase { private readonly string fileName; /// /// Triggers passing instances which read an image from the given file /// One instance will be passed for each the pixel format defined by the pixelTypes parameter /// /// The name of the file /// The requested pixel types /// Additional theory parameter values public WithFileAttribute(string fileName, PixelTypes pixelTypes, params object[] additionalParameters) : base(null, pixelTypes, additionalParameters) { this.fileName = fileName; } /// /// Triggers passing instances which read an image from the given file /// One instance will be passed for each the pixel format defined by the pixelTypes parameter /// /// The name of the file /// The requested pixel types /// Additional theory parameter values public WithFileAttribute(string fileName, string dataMemberName, PixelTypes pixelTypes, params object[] additionalParameters) : base(dataMemberName, pixelTypes, additionalParameters) { this.fileName = fileName; } protected override object[] GetFactoryMethodArgs(MethodInfo testMethod, Type factoryType) => new object[] { this.fileName }; protected override string GetFactoryMethodName(MethodInfo testMethod) => "File"; }