mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
Run formatting (#2230)
This commit is contained in:
@ -3,36 +3,35 @@ using AutoFixture.Kernel;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Test.Common.AutoFixture;
|
||||
|
||||
namespace Bit.Core.Test.AutoFixture.CurrentContextFixtures
|
||||
namespace Bit.Core.Test.AutoFixture.CurrentContextFixtures;
|
||||
|
||||
internal class CurrentContext : ICustomization
|
||||
{
|
||||
internal class CurrentContext : ICustomization
|
||||
public void Customize(IFixture fixture)
|
||||
{
|
||||
public void Customize(IFixture fixture)
|
||||
{
|
||||
fixture.Customizations.Add(new CurrentContextBuilder());
|
||||
}
|
||||
}
|
||||
|
||||
internal class CurrentContextBuilder : ISpecimenBuilder
|
||||
{
|
||||
public object Create(object request, ISpecimenContext context)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
if (!(request is Type typeRequest))
|
||||
{
|
||||
return new NoSpecimen();
|
||||
}
|
||||
if (typeof(ICurrentContext) != typeRequest)
|
||||
{
|
||||
return new NoSpecimen();
|
||||
}
|
||||
|
||||
var obj = new Fixture().WithAutoNSubstitutions().Create<ICurrentContext>();
|
||||
obj.Organizations = context.Create<List<CurrentContentOrganization>>();
|
||||
return obj;
|
||||
}
|
||||
fixture.Customizations.Add(new CurrentContextBuilder());
|
||||
}
|
||||
}
|
||||
|
||||
internal class CurrentContextBuilder : ISpecimenBuilder
|
||||
{
|
||||
public object Create(object request, ISpecimenContext context)
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(context));
|
||||
}
|
||||
if (!(request is Type typeRequest))
|
||||
{
|
||||
return new NoSpecimen();
|
||||
}
|
||||
if (typeof(ICurrentContext) != typeRequest)
|
||||
{
|
||||
return new NoSpecimen();
|
||||
}
|
||||
|
||||
var obj = new Fixture().WithAutoNSubstitutions().Create<ICurrentContext>();
|
||||
obj.Organizations = context.Create<List<CurrentContentOrganization>>();
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user