// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using System.Reflection; namespace SixLabors.ImageSharp.Tests; /// /// Triggers passing instances which return the image produced by the given test class member method /// instances will be passed for each the pixel format defined by the pixelTypes parameter. /// The parameter of the factory method must be a instance. /// public class WithMemberFactoryAttribute : ImageDataAttributeBase { private readonly string memberMethodName; /// /// Triggers passing instances which return the image produced by the given test class member method /// instances will be passed for each the pixel format defined by the pixelTypes parameter. /// /// The name of the static test class which returns the image. /// The requested pixel types. /// Additional theory parameter values. public WithMemberFactoryAttribute(string memberMethodName, PixelTypes pixelTypes, params object[] additionalParameters) : base(null, pixelTypes, additionalParameters) { this.memberMethodName = memberMethodName; } protected override object[] GetFactoryMethodArgs(MethodInfo testMethod, Type factoryType) { return [testMethod.DeclaringType.FullName, this.memberMethodName]; } protected override string GetFactoryMethodName(MethodInfo testMethod) => "Lambda"; }