1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-30 18:17:36 +01:00
bitwarden-server/test/Infrastructure.EFIntegration.Test/AutoFixture/SsoUserFixtures.cs
2022-08-29 16:06:55 -04:00

37 lines
1.4 KiB
C#

using AutoFixture;
using Bit.Core.Entities;
using Bit.Core.Test.AutoFixture.UserFixtures;
using Bit.Infrastructure.EntityFramework.Repositories;
using Bit.Test.Common.AutoFixture;
using Bit.Test.Common.AutoFixture.Attributes;
namespace Bit.Infrastructure.EFIntegration.Test.AutoFixture;
internal class EfSsoUser : ICustomization
{
public void Customize(IFixture fixture)
{
fixture.Customizations.Add(new IgnoreVirtualMembersCustomization());
fixture.Customizations.Add(new GlobalSettingsBuilder());
fixture.Customizations.Add(new UserBuilder());
fixture.Customizations.Add(new OrganizationBuilder());
fixture.Customize<SsoUser>(composer => composer.Without(ou => ou.Id));
fixture.Customizations.Add(new EfRepositoryListBuilder<SsoUserRepository>());
fixture.Customizations.Add(new EfRepositoryListBuilder<UserRepository>());
fixture.Customizations.Add(new EfRepositoryListBuilder<OrganizationRepository>());
}
}
internal class EfSsoUserAutoDataAttribute : CustomAutoDataAttribute
{
public EfSsoUserAutoDataAttribute() : base(new SutProviderCustomization(), new EfSsoUser())
{ }
}
internal class InlineEfSsoUserAutoDataAttribute : InlineCustomAutoDataAttribute
{
public InlineEfSsoUserAutoDataAttribute(params object[] values) : base(new[] { typeof(SutProviderCustomization),
typeof(EfSsoUser) }, values)
{ }
}