1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-01 13:43:23 +01:00
bitwarden-server/bitwarden_license/test/Commercial.Core.Test/AutoFixture/ProviderUserFixtures.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.2 KiB
C#
Raw Normal View History

using System.Reflection;
using AutoFixture;
using AutoFixture.Xunit2;
using Bit.Core.Enums.Provider;
namespace Bit.Commercial.Core.Test.AutoFixture;
internal class ProviderUser : ICustomization
2022-08-29 22:06:55 +02:00
{
public ProviderUserStatusType Status { get; set; }
public ProviderUserType Type { get; set; }
public ProviderUser(ProviderUserStatusType status, ProviderUserType type)
2022-08-29 22:06:55 +02:00
{
Status = status;
Type = type;
2022-08-29 20:53:16 +02:00
}
public void Customize(IFixture fixture)
{
fixture.Customize<Bit.Core.Entities.Provider.ProviderUser>(composer => composer
.With(o => o.Type, Type)
.With(o => o.Status, Status));
2022-08-29 22:06:55 +02:00
}
}
public class ProviderUserAttribute : CustomizeAttribute
2022-08-29 22:06:55 +02:00
{
private readonly ProviderUserStatusType _status;
private readonly ProviderUserType _type;
public ProviderUserAttribute(
ProviderUserStatusType status = ProviderUserStatusType.Confirmed,
ProviderUserType type = ProviderUserType.ProviderAdmin)
2022-08-29 22:06:55 +02:00
{
_status = status;
_type = type;
2022-08-29 22:06:55 +02:00
}
public override ICustomization GetCustomization(ParameterInfo parameter)
{
return new ProviderUser(_status, _type);
}
}