// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Xunit.Sdk;
namespace SixLabors.ImageSharp.Tests
{
///
/// Base class for Theory Data attributes which pass an instance of to the test case.
///
public abstract class ImageDataAttributeBase : DataAttribute
{
protected readonly object[] AdditionalParameters;
protected readonly PixelTypes PixelTypes;
static ImageDataAttributeBase()
{
// ImageDataAttributes are used in almost all tests, thus a good place to enforce the execution of
// TestEnvironment static constructor before anything else is done.
TestEnvironment.EnsureSharedInitializersDone();
}
///
/// Initializes a new instance of the class.
///
protected ImageDataAttributeBase(string memberName, PixelTypes pixelTypes, object[] additionalParameters)
{
this.PixelTypes = pixelTypes;
this.AdditionalParameters = additionalParameters;
this.MemberName = memberName;
}
///
/// Gets the member name.
///
public string MemberName { get; }
///
/// Gets or sets the member type.
///
public Type MemberType { get; set; }
/// Returns the data to be used to test the theory.
/// The method that is being tested
/// One or more sets of theory data. Each invocation of the test method
/// is represented by a single object array.
public override IEnumerable