mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
33 lines
1006 B
C#
33 lines
1006 B
C#
using AutoFixture;
|
|
using Bit.Core.Entities;
|
|
using Bit.Test.Common.AutoFixture.Attributes;
|
|
|
|
namespace Bit.Core.Test.AutoFixture.OrganizationSponsorshipFixtures;
|
|
|
|
public class OrganizationSponsorshipCustomizeAttribute : BitCustomizeAttribute
|
|
{
|
|
public bool ToDelete = false;
|
|
public override ICustomization GetCustomization() => ToDelete ?
|
|
new ToDeleteOrganizationSponsorship() :
|
|
new ValidOrganizationSponsorship();
|
|
}
|
|
|
|
public class ValidOrganizationSponsorship : ICustomization
|
|
{
|
|
public void Customize(IFixture fixture)
|
|
{
|
|
fixture.Customize<OrganizationSponsorship>(composer => composer
|
|
.With(s => s.ToDelete, false)
|
|
.With(s => s.LastSyncDate, DateTime.UtcNow.AddDays(new Random().Next(-90, 0))));
|
|
}
|
|
}
|
|
|
|
public class ToDeleteOrganizationSponsorship : ICustomization
|
|
{
|
|
public void Customize(IFixture fixture)
|
|
{
|
|
fixture.Customize<OrganizationSponsorship>(composer => composer
|
|
.With(s => s.ToDelete, true));
|
|
}
|
|
}
|