mirror of
https://github.com/bitwarden/server.git
synced 2024-12-11 15:17:44 +01:00
26 lines
730 B
C#
26 lines
730 B
C#
|
using System;
|
||
|
using System.Linq;
|
||
|
using AutoFixture;
|
||
|
using AutoFixture.Xunit2;
|
||
|
|
||
|
namespace Bit.Core.Test.AutoFixture.Attributes
|
||
|
{
|
||
|
internal class CustomAutoDataAttribute : AutoDataAttribute
|
||
|
{
|
||
|
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;
|
||
|
})
|
||
|
{ }
|
||
|
}
|
||
|
}
|