2021-06-03 18:58:29 +02:00
|
|
|
|
using System.Reflection;
|
|
|
|
|
using AutoFixture;
|
|
|
|
|
using AutoFixture.Xunit2;
|
|
|
|
|
using Bit.Core.Enums.Provider;
|
|
|
|
|
|
2021-06-30 09:35:26 +02:00
|
|
|
|
namespace Bit.CommCore.Test.AutoFixture.ProviderUserFixtures
|
2021-06-03 18:58:29 +02:00
|
|
|
|
{
|
|
|
|
|
internal class ProviderUser : ICustomization
|
|
|
|
|
{
|
|
|
|
|
public ProviderUserStatusType Status { get; set; }
|
|
|
|
|
public ProviderUserType Type { get; set; }
|
|
|
|
|
|
|
|
|
|
public ProviderUser(ProviderUserStatusType status, ProviderUserType type)
|
|
|
|
|
{
|
|
|
|
|
Status = status;
|
|
|
|
|
Type = type;
|
|
|
|
|
}
|
2021-12-16 15:35:09 +01:00
|
|
|
|
|
2021-06-03 18:58:29 +02:00
|
|
|
|
public void Customize(IFixture fixture)
|
|
|
|
|
{
|
2022-01-11 10:40:51 +01:00
|
|
|
|
fixture.Customize<Core.Entities.Provider.ProviderUser>(composer => composer
|
2021-06-03 18:58:29 +02:00
|
|
|
|
.With(o => o.Type, Type)
|
|
|
|
|
.With(o => o.Status, Status));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ProviderUserAttribute : CustomizeAttribute
|
|
|
|
|
{
|
|
|
|
|
private readonly ProviderUserStatusType _status;
|
|
|
|
|
private readonly ProviderUserType _type;
|
|
|
|
|
|
|
|
|
|
public ProviderUserAttribute(
|
|
|
|
|
ProviderUserStatusType status = ProviderUserStatusType.Confirmed,
|
|
|
|
|
ProviderUserType type = ProviderUserType.ProviderAdmin)
|
|
|
|
|
{
|
|
|
|
|
_status = status;
|
|
|
|
|
_type = type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override ICustomization GetCustomization(ParameterInfo parameter)
|
|
|
|
|
{
|
|
|
|
|
return new ProviderUser(_status, _type);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|