mirror of
https://github.com/bitwarden/server.git
synced 2024-11-28 13:15:12 +01:00
7cf6742595
* PM-13236 PasswordHealthReportApplications db * PM-13236 incorporated pr comments * PM-13236 fixed error in SQL script * PM-13236 resolve quality scan errors SQL71006, SQL7101, SQL70001 * PM-13236 fixed warnings on procedures * PM-13236 added efMigrations * PM-13236 renamed files to PasswordHealthReportApplication (singular) * PM-13236 changed file name to more appropriate naming * PM-13236 changed the file name singular * PM-13236 PasswordHealthReportApplication Entities and Repos * PM-13236 moved files under tools from core * PM-13236 Entity PasswordHealthReportApplication namespace changed to tools/entities * PM-13236 moved Repos and Interfaces to tools * PM-13236 migrated model to tools namespace * PM-13236 minor fixes to the unit tests * PM-13236 fixed script errors during build * PM-13236 Script to drop PasswordHealthReportApplications if it exists * PM-13236 fixes to database snapshot * PM-13236 updated databasesnapshots * PM-13236 Update database model changes for Mysql * PM-13236 update model changes for Sqlite * PM-13236 updated the models to remove commented code * PM-13236 added correct db snapshot for MySql * PM-13236 updated database snapshot for Postgres * PM-13236 updated database snapshot for Sqlite * PM-13236 removed unwanted directive to fix linting error * PM-13236 removed redundant script files
83 lines
3.5 KiB
C#
83 lines
3.5 KiB
C#
using AutoFixture;
|
|
using AutoFixture.Kernel;
|
|
using Bit.Core.Tools.Entities;
|
|
using Bit.Infrastructure.EntityFramework.AdminConsole.Repositories;
|
|
using Bit.Infrastructure.EntityFramework.Repositories;
|
|
using Bit.Infrastructure.EntityFramework.Tools.Repositories;
|
|
using Bit.Test.Common.AutoFixture;
|
|
using Bit.Test.Common.AutoFixture.Attributes;
|
|
|
|
namespace Bit.Infrastructure.EFIntegration.Test.AutoFixture;
|
|
|
|
internal class PasswordHealthReportApplicationBuilder : ISpecimenBuilder
|
|
{
|
|
public object Create(object request, ISpecimenContext context)
|
|
{
|
|
if (context == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(context));
|
|
}
|
|
|
|
var type = request as Type;
|
|
if (type == null || type != typeof(PasswordHealthReportApplication))
|
|
{
|
|
return new NoSpecimen();
|
|
}
|
|
|
|
var fixture = new Fixture();
|
|
var obj = fixture.WithAutoNSubstitutions().Create<PasswordHealthReportApplication>();
|
|
return obj;
|
|
}
|
|
}
|
|
|
|
internal class EfPasswordHealthReportApplication : ICustomization
|
|
{
|
|
public void Customize(IFixture fixture)
|
|
{
|
|
fixture.Customizations.Add(new IgnoreVirtualMembersCustomization());
|
|
fixture.Customizations.Add(new GlobalSettingsBuilder());
|
|
fixture.Customizations.Add(new PasswordHealthReportApplicationBuilder());
|
|
fixture.Customizations.Add(new OrganizationBuilder());
|
|
fixture.Customizations.Add(new EfRepositoryListBuilder<PasswordHealthReportApplicationRepository>());
|
|
fixture.Customizations.Add(new EfRepositoryListBuilder<OrganizationRepository>());
|
|
}
|
|
}
|
|
|
|
internal class EfPasswordHealthReportApplicationApplicableToUser : ICustomization
|
|
{
|
|
public void Customize(IFixture fixture)
|
|
{
|
|
fixture.Customizations.Add(new IgnoreVirtualMembersCustomization());
|
|
fixture.Customizations.Add(new GlobalSettingsBuilder());
|
|
fixture.Customizations.Add(new PasswordHealthReportApplicationBuilder());
|
|
fixture.Customizations.Add(new OrganizationBuilder());
|
|
fixture.Customizations.Add(new EfRepositoryListBuilder<PasswordHealthReportApplicationRepository>());
|
|
fixture.Customizations.Add(new EfRepositoryListBuilder<UserRepository>());
|
|
fixture.Customizations.Add(new EfRepositoryListBuilder<OrganizationRepository>());
|
|
fixture.Customizations.Add(new EfRepositoryListBuilder<OrganizationUserRepository>());
|
|
fixture.Customizations.Add(new EfRepositoryListBuilder<ProviderRepository>());
|
|
fixture.Customizations.Add(new EfRepositoryListBuilder<ProviderUserRepository>());
|
|
fixture.Customizations.Add(new EfRepositoryListBuilder<ProviderOrganizationRepository>());
|
|
}
|
|
}
|
|
|
|
internal class EfPasswordHealthReportApplicationAutoDataAttribute : CustomAutoDataAttribute
|
|
{
|
|
public EfPasswordHealthReportApplicationAutoDataAttribute() : base(new SutProviderCustomization(), new EfPasswordHealthReportApplication())
|
|
{ }
|
|
}
|
|
|
|
internal class EfPasswordHealthReportApplicationApplicableToUserInlineAutoDataAttribute : InlineCustomAutoDataAttribute
|
|
{
|
|
public EfPasswordHealthReportApplicationApplicableToUserInlineAutoDataAttribute(params object[] values) :
|
|
base(new[] { typeof(SutProviderCustomization), typeof(EfPasswordHealthReportApplicationApplicableToUser) }, values)
|
|
{ }
|
|
}
|
|
|
|
internal class InlineEfPasswordHealthReportApplicationAutoDataAttribute : InlineCustomAutoDataAttribute
|
|
{
|
|
public InlineEfPasswordHealthReportApplicationAutoDataAttribute(params object[] values) : base(new[] { typeof(SutProviderCustomization),
|
|
typeof(EfPolicy) }, values)
|
|
{ }
|
|
}
|