diff --git a/src/Core/Auth/Services/Implementations/TwoFactorEmailService.cs b/src/Core/Auth/Services/Implementations/TwoFactorEmailService.cs index aba265cc71..cad27850da 100644 --- a/src/Core/Auth/Services/Implementations/TwoFactorEmailService.cs +++ b/src/Core/Auth/Services/Implementations/TwoFactorEmailService.cs @@ -12,9 +12,9 @@ namespace Bit.Core.Auth.Services; public class TwoFactorEmailService : ITwoFactorEmailService { - private ICurrentContext _currentContext; - private UserManager _userManager; - private IMailService _mailService; + private readonly ICurrentContext _currentContext; + private readonly UserManager _userManager; + private readonly IMailService _mailService; public TwoFactorEmailService( ICurrentContext currentContext, diff --git a/test/Core.Test/Auth/Services/TwoFactorEmailServiceTests.cs b/test/Core.Test/Auth/Services/TwoFactorEmailServiceTests.cs index caa9964e17..d817d09662 100644 --- a/test/Core.Test/Auth/Services/TwoFactorEmailServiceTests.cs +++ b/test/Core.Test/Auth/Services/TwoFactorEmailServiceTests.cs @@ -18,6 +18,7 @@ namespace Bit.Core.Test.Auth.Services; [SutProviderCustomize] public class TwoFactorEmailServiceTests { + [Theory, BitAutoData] public async Task SendTwoFactorEmailAsync_Success(SutProvider sutProvider, User user) { @@ -34,7 +35,7 @@ public class TwoFactorEmailServiceTests .GenerateAsync("TwoFactor", Arg.Any>(), user) .Returns(Task.FromResult(token)); - var context = sutProvider.GetDependency(); + var context = Substitute.For(); context.DeviceType = DeviceType.Android; context.IpAddress = IpAddress; @@ -109,7 +110,7 @@ public class TwoFactorEmailServiceTests { var sutProvider = new SutProvider(); - var context = sutProvider.GetDependency(); + var context = Substitute.For(); context.DeviceType = deviceType; context.IpAddress = "1.1.1.1"; @@ -125,7 +126,7 @@ public class TwoFactorEmailServiceTests { var sutProvider = new SutProvider(); - var context = sutProvider.GetDependency(); + var context = Substitute.For(); context.DeviceType = null; context.IpAddress = "1.1.1.1";