mirror of
https://github.com/bitwarden/server
synced 2025-12-13 23:03:36 +00:00
Revert filescoped (#2227)
* Revert "Add git blame entry (#2226)" This reverts commit239286737d. * Revert "Turn on file scoped namespaces (#2225)" This reverts commit34fb4cca2a.
This commit is contained in:
@@ -2,31 +2,32 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Org.BouncyCastle.Security;
|
||||
|
||||
namespace Bit.Test.Common.AutoFixture;
|
||||
|
||||
/// <summary>
|
||||
/// Disables setting of Auto Properties on the Controller to avoid ASP.net initialization errors. Still sets constructor dependencies.
|
||||
/// </summary>
|
||||
/// <param name="fixture"></param>
|
||||
public class ControllerCustomization : ICustomization
|
||||
namespace Bit.Test.Common.AutoFixture
|
||||
{
|
||||
private readonly Type _controllerType;
|
||||
public ControllerCustomization(Type controllerType)
|
||||
/// <summary>
|
||||
/// Disables setting of Auto Properties on the Controller to avoid ASP.net initialization errors. Still sets constructor dependencies.
|
||||
/// </summary>
|
||||
/// <param name="fixture"></param>
|
||||
public class ControllerCustomization : ICustomization
|
||||
{
|
||||
if (!controllerType.IsAssignableTo(typeof(Controller)))
|
||||
private readonly Type _controllerType;
|
||||
public ControllerCustomization(Type controllerType)
|
||||
{
|
||||
throw new InvalidParameterException($"{nameof(controllerType)} must derive from {typeof(Controller).Name}");
|
||||
if (!controllerType.IsAssignableTo(typeof(Controller)))
|
||||
{
|
||||
throw new InvalidParameterException($"{nameof(controllerType)} must derive from {typeof(Controller).Name}");
|
||||
}
|
||||
|
||||
_controllerType = controllerType;
|
||||
}
|
||||
|
||||
_controllerType = controllerType;
|
||||
public void Customize(IFixture fixture)
|
||||
{
|
||||
fixture.Customizations.Add(new BuilderWithoutAutoProperties(_controllerType));
|
||||
}
|
||||
}
|
||||
|
||||
public void Customize(IFixture fixture)
|
||||
public class ControllerCustomization<T> : ICustomization where T : Controller
|
||||
{
|
||||
fixture.Customizations.Add(new BuilderWithoutAutoProperties(_controllerType));
|
||||
public void Customize(IFixture fixture) => new ControllerCustomization(typeof(T)).Customize(fixture);
|
||||
}
|
||||
}
|
||||
public class ControllerCustomization<T> : ICustomization where T : Controller
|
||||
{
|
||||
public void Customize(IFixture fixture) => new ControllerCustomization(typeof(T)).Customize(fixture);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user