mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
[PM-13322] [BEEEP] Add PolicyValidators and refactor policy save logic (#4877)
This commit is contained in:
@ -127,7 +127,6 @@ public class SutProvider<TSut> : ISutProvider
|
||||
return _sutProvider.GetDependency(parameterInfo.ParameterType, "");
|
||||
}
|
||||
|
||||
|
||||
// This is the equivalent of _fixture.Create<parameterInfo.ParameterType>, but no overload for
|
||||
// Create(Type type) exists.
|
||||
var dependency = new SpecimenContext(_fixture).Resolve(new SeededRequest(parameterInfo.ParameterType,
|
||||
|
@ -1,6 +1,7 @@
|
||||
using AutoFixture;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using Microsoft.Extensions.Time.Testing;
|
||||
using NSubstitute;
|
||||
using RichardSzalay.MockHttp;
|
||||
|
||||
@ -47,4 +48,19 @@ public static class SutProviderExtensions
|
||||
.SetDependency(mockHttpClientFactory)
|
||||
.Create();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Configures SutProvider to use FakeTimeProvider.
|
||||
/// It is registered under both the TimeProvider type and the FakeTimeProvider type
|
||||
/// so that it can be retrieved in a type-safe manner with GetDependency.
|
||||
/// This can be chained with other builder methods; make sure to call
|
||||
/// <see cref="ISutProvider.Create"/> before use.
|
||||
/// </summary>
|
||||
public static SutProvider<T> WithFakeTimeProvider<T>(this SutProvider<T> sutProvider)
|
||||
{
|
||||
var fakeTimeProvider = new FakeTimeProvider();
|
||||
return sutProvider
|
||||
.SetDependency((TimeProvider)fakeTimeProvider)
|
||||
.SetDependency(fakeTimeProvider);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user