1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

[PM-13322] [BEEEP] Add PolicyValidators and refactor policy save logic (#4877)

This commit is contained in:
Thomas Rittson
2024-10-22 09:18:34 +10:00
committed by GitHub
parent 75cc907785
commit dfa411131d
27 changed files with 1564 additions and 6 deletions

View File

@ -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);
}
}