2020-01-10 14:47:58 +01:00
|
|
|
|
using System;
|
2019-07-06 05:35:54 +02:00
|
|
|
|
using Bit.Core.Repositories;
|
|
|
|
|
using Bit.Core.Services;
|
2021-02-22 22:35:16 +01:00
|
|
|
|
using Bit.Core.Settings;
|
2019-07-06 05:35:54 +02:00
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using NSubstitute;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Test.Services
|
|
|
|
|
{
|
|
|
|
|
public class LicensingServiceTests
|
|
|
|
|
{
|
|
|
|
|
private readonly LicensingService _sut;
|
|
|
|
|
|
|
|
|
|
private readonly GlobalSettings _globalSettings;
|
|
|
|
|
private readonly IUserRepository _userRepository;
|
|
|
|
|
private readonly IOrganizationRepository _organizationRepository;
|
|
|
|
|
private readonly IOrganizationUserRepository _organizationUserRepository;
|
2020-05-18 22:06:34 +02:00
|
|
|
|
private readonly IMailService _mailService;
|
2020-01-10 14:47:58 +01:00
|
|
|
|
private readonly IWebHostEnvironment _hostingEnvironment;
|
2019-07-06 05:35:54 +02:00
|
|
|
|
private readonly ILogger<LicensingService> _logger;
|
|
|
|
|
|
|
|
|
|
public LicensingServiceTests()
|
|
|
|
|
{
|
|
|
|
|
_userRepository = Substitute.For<IUserRepository>();
|
|
|
|
|
_organizationRepository = Substitute.For<IOrganizationRepository>();
|
|
|
|
|
_organizationUserRepository = Substitute.For<IOrganizationUserRepository>();
|
2020-05-18 22:06:34 +02:00
|
|
|
|
_mailService = Substitute.For<IMailService>();
|
2020-01-10 14:47:58 +01:00
|
|
|
|
_hostingEnvironment = Substitute.For<IWebHostEnvironment>();
|
2019-07-06 05:35:54 +02:00
|
|
|
|
_logger = Substitute.For<ILogger<LicensingService>>();
|
|
|
|
|
_globalSettings = new GlobalSettings();
|
|
|
|
|
|
|
|
|
|
_sut = new LicensingService(
|
|
|
|
|
_userRepository,
|
|
|
|
|
_organizationRepository,
|
|
|
|
|
_organizationUserRepository,
|
2020-05-18 22:06:34 +02:00
|
|
|
|
_mailService,
|
2019-07-06 05:35:54 +02:00
|
|
|
|
_hostingEnvironment,
|
|
|
|
|
_logger,
|
|
|
|
|
_globalSettings
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove this test when we add actual tests. It only proves that
|
|
|
|
|
// we've properly constructed the system under test.
|
|
|
|
|
[Fact(Skip = "Needs additional work")]
|
|
|
|
|
public void ServiceExists()
|
|
|
|
|
{
|
|
|
|
|
Assert.NotNull(_sut);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|