2020-11-23 15:48:05 +01:00
|
|
|
using System;
|
|
|
|
using System.Linq;
|
|
|
|
using AutoFixture;
|
|
|
|
using AutoFixture.Xunit2;
|
|
|
|
|
|
|
|
namespace Bit.Core.Test.AutoFixture.Attributes
|
|
|
|
{
|
2021-06-30 09:35:26 +02:00
|
|
|
public class CustomAutoDataAttribute : AutoDataAttribute
|
2020-11-23 15:48:05 +01:00
|
|
|
{
|
|
|
|
public CustomAutoDataAttribute(params Type[] iCustomizationTypes) : this(iCustomizationTypes
|
|
|
|
.Select(t => (ICustomization)Activator.CreateInstance(t)).ToArray())
|
|
|
|
{ }
|
|
|
|
|
|
|
|
public CustomAutoDataAttribute(params ICustomization[] customizations) : base(() =>
|
|
|
|
{
|
|
|
|
var fixture = new Fixture();
|
|
|
|
foreach (var customization in customizations)
|
|
|
|
{
|
|
|
|
fixture.Customize(customization);
|
|
|
|
}
|
|
|
|
return fixture;
|
|
|
|
})
|
|
|
|
{ }
|
|
|
|
}
|
|
|
|
}
|