mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
Establish IFeatureService as scoped (#3679)
* Establish IFeatureService as scoped * Lint * Feedback around injection
This commit is contained in:
@ -14,7 +14,6 @@ using Bit.Core.Auth.Models.Api.Request.Accounts;
|
||||
using Bit.Core.Auth.Services;
|
||||
using Bit.Core.Auth.UserFeatures.UserKey;
|
||||
using Bit.Core.Auth.UserFeatures.UserMasterPassword.Interfaces;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Entities;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Exceptions;
|
||||
@ -54,7 +53,6 @@ public class AccountsControllerTests : IDisposable
|
||||
private readonly ISetInitialMasterPasswordCommand _setInitialMasterPasswordCommand;
|
||||
private readonly IRotateUserKeyCommand _rotateUserKeyCommand;
|
||||
private readonly IFeatureService _featureService;
|
||||
private readonly ICurrentContext _currentContext;
|
||||
|
||||
private readonly IRotationValidator<IEnumerable<CipherWithIdRequestModel>, IEnumerable<Cipher>> _cipherValidator;
|
||||
private readonly IRotationValidator<IEnumerable<FolderWithIdRequestModel>, IEnumerable<Folder>> _folderValidator;
|
||||
@ -84,7 +82,6 @@ public class AccountsControllerTests : IDisposable
|
||||
_setInitialMasterPasswordCommand = Substitute.For<ISetInitialMasterPasswordCommand>();
|
||||
_rotateUserKeyCommand = Substitute.For<IRotateUserKeyCommand>();
|
||||
_featureService = Substitute.For<IFeatureService>();
|
||||
_currentContext = Substitute.For<ICurrentContext>();
|
||||
_cipherValidator =
|
||||
Substitute.For<IRotationValidator<IEnumerable<CipherWithIdRequestModel>, IEnumerable<Cipher>>>();
|
||||
_folderValidator =
|
||||
@ -113,7 +110,6 @@ public class AccountsControllerTests : IDisposable
|
||||
_setInitialMasterPasswordCommand,
|
||||
_rotateUserKeyCommand,
|
||||
_featureService,
|
||||
_currentContext,
|
||||
_cipherValidator,
|
||||
_folderValidator,
|
||||
_sendValidator,
|
||||
|
@ -1,6 +1,5 @@
|
||||
using AutoFixture.Xunit2;
|
||||
using Bit.Api.Controllers;
|
||||
using Bit.Core.Context;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Settings;
|
||||
using NSubstitute;
|
||||
@ -13,17 +12,14 @@ public class ConfigControllerTests : IDisposable
|
||||
private readonly ConfigController _sut;
|
||||
private readonly GlobalSettings _globalSettings;
|
||||
private readonly IFeatureService _featureService;
|
||||
private readonly ICurrentContext _currentContext;
|
||||
|
||||
public ConfigControllerTests()
|
||||
{
|
||||
_globalSettings = new GlobalSettings();
|
||||
_currentContext = Substitute.For<ICurrentContext>();
|
||||
_featureService = Substitute.For<IFeatureService>();
|
||||
|
||||
_sut = new ConfigController(
|
||||
_globalSettings,
|
||||
_currentContext,
|
||||
_featureService
|
||||
);
|
||||
}
|
||||
@ -36,7 +32,7 @@ public class ConfigControllerTests : IDisposable
|
||||
[Theory, AutoData]
|
||||
public void GetConfigs_WithFeatureStates(Dictionary<string, object> featureStates)
|
||||
{
|
||||
_featureService.GetAll(_currentContext).Returns(featureStates);
|
||||
_featureService.GetAll().Returns(featureStates);
|
||||
|
||||
var response = _sut.GetConfigs();
|
||||
|
||||
|
Reference in New Issue
Block a user