mirror of
https://github.com/bitwarden/server.git
synced 2025-06-17 00:03:17 -05:00
Fixed tests.
This commit is contained in:
parent
a8a04102a6
commit
145c969d8b
@ -12,9 +12,9 @@ namespace Bit.Core.Auth.Services;
|
||||
|
||||
public class TwoFactorEmailService : ITwoFactorEmailService
|
||||
{
|
||||
private ICurrentContext _currentContext;
|
||||
private UserManager<User> _userManager;
|
||||
private IMailService _mailService;
|
||||
private readonly ICurrentContext _currentContext;
|
||||
private readonly UserManager<User> _userManager;
|
||||
private readonly IMailService _mailService;
|
||||
|
||||
public TwoFactorEmailService(
|
||||
ICurrentContext currentContext,
|
||||
|
@ -18,6 +18,7 @@ namespace Bit.Core.Test.Auth.Services;
|
||||
[SutProviderCustomize]
|
||||
public class TwoFactorEmailServiceTests
|
||||
{
|
||||
|
||||
[Theory, BitAutoData]
|
||||
public async Task SendTwoFactorEmailAsync_Success(SutProvider<TwoFactorEmailService> sutProvider, User user)
|
||||
{
|
||||
@ -34,7 +35,7 @@ public class TwoFactorEmailServiceTests
|
||||
.GenerateAsync("TwoFactor", Arg.Any<UserManager<User>>(), user)
|
||||
.Returns(Task.FromResult(token));
|
||||
|
||||
var context = sutProvider.GetDependency<ICurrentContext>();
|
||||
var context = Substitute.For<ICurrentContext>();
|
||||
context.DeviceType = DeviceType.Android;
|
||||
context.IpAddress = IpAddress;
|
||||
|
||||
@ -109,7 +110,7 @@ public class TwoFactorEmailServiceTests
|
||||
{
|
||||
var sutProvider = new SutProvider<TwoFactorEmailService>();
|
||||
|
||||
var context = sutProvider.GetDependency<ICurrentContext>();
|
||||
var context = Substitute.For<ICurrentContext>();
|
||||
context.DeviceType = deviceType;
|
||||
context.IpAddress = "1.1.1.1";
|
||||
|
||||
@ -125,7 +126,7 @@ public class TwoFactorEmailServiceTests
|
||||
{
|
||||
var sutProvider = new SutProvider<TwoFactorEmailService>();
|
||||
|
||||
var context = sutProvider.GetDependency<ICurrentContext>();
|
||||
var context = Substitute.For<ICurrentContext>();
|
||||
context.DeviceType = null;
|
||||
context.IpAddress = "1.1.1.1";
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user