1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-25 12:45:18 +01:00
bitwarden-server/test/Core.Test/AutoFixture/GlobalSettingsFixtures.cs
Justin Baur bae03feffe
Revert filescoped (#2227)
* Revert "Add git blame entry (#2226)"

This reverts commit 239286737d.

* Revert "Turn on file scoped namespaces (#2225)"

This reverts commit 34fb4cca2a.
2022-08-29 15:53:48 -04:00

33 lines
940 B
C#

using System.Reflection;
using AutoFixture;
using AutoFixture.Kernel;
using AutoFixture.Xunit2;
using Bit.Core.Test.Helpers.Factories;
namespace Bit.Test.Common.AutoFixture
{
public class GlobalSettingsBuilder : ISpecimenBuilder
{
public object Create(object request, ISpecimenContext context)
{
if (context == null)
{
throw new ArgumentNullException(nameof(context));
}
var pi = request as ParameterInfo;
var fixture = new Fixture();
if (pi == null || pi.ParameterType != typeof(Bit.Core.Settings.GlobalSettings))
return new NoSpecimen();
return GlobalSettingsFactory.GlobalSettings;
}
}
public class GlobalSettingsCustomizeAttribute : CustomizeAttribute
{
public override ICustomization GetCustomization(ParameterInfo parameter) => new GlobalSettings();
}
}