2019-09-20 14:04:05 +02: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.Extensions.Logging;
|
|
|
|
|
using NSubstitute;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace Bit.Core.Test.Services
|
|
|
|
|
{
|
|
|
|
|
public class StripePaymentServiceTests
|
|
|
|
|
{
|
|
|
|
|
private readonly StripePaymentService _sut;
|
|
|
|
|
|
|
|
|
|
private readonly ITransactionRepository _transactionRepository;
|
2019-09-20 14:04:05 +02:00
|
|
|
|
private readonly IUserRepository _userRepository;
|
|
|
|
|
private readonly IAppleIapService _appleIapService;
|
2019-07-06 05:35:54 +02:00
|
|
|
|
private readonly GlobalSettings _globalSettings;
|
|
|
|
|
private readonly ILogger<StripePaymentService> _logger;
|
2020-12-04 23:37:35 +01:00
|
|
|
|
private readonly ITaxRateRepository _taxRateRepository;
|
2019-07-06 05:35:54 +02:00
|
|
|
|
|
|
|
|
|
public StripePaymentServiceTests()
|
|
|
|
|
{
|
|
|
|
|
_transactionRepository = Substitute.For<ITransactionRepository>();
|
2019-09-20 14:04:05 +02:00
|
|
|
|
_userRepository = Substitute.For<IUserRepository>();
|
|
|
|
|
_appleIapService = Substitute.For<IAppleIapService>();
|
2019-07-06 05:35:54 +02:00
|
|
|
|
_globalSettings = new GlobalSettings();
|
|
|
|
|
_logger = Substitute.For<ILogger<StripePaymentService>>();
|
2020-12-09 20:04:46 +01:00
|
|
|
|
_taxRateRepository = Substitute.For<ITaxRateRepository>();
|
2019-07-06 05:35:54 +02:00
|
|
|
|
|
|
|
|
|
_sut = new StripePaymentService(
|
|
|
|
|
_transactionRepository,
|
2019-09-20 14:04:05 +02:00
|
|
|
|
_userRepository,
|
2019-07-06 05:35:54 +02:00
|
|
|
|
_globalSettings,
|
2019-09-20 14:04:05 +02:00
|
|
|
|
_appleIapService,
|
2020-12-04 23:37:35 +01:00
|
|
|
|
_logger,
|
|
|
|
|
_taxRateRepository
|
2019-07-06 05:35:54 +02:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remove this test when we add actual tests. It only proves that
|
|
|
|
|
// we've properly constructed the system under test.
|
|
|
|
|
[Fact]
|
|
|
|
|
public void ServiceExists()
|
|
|
|
|
{
|
|
|
|
|
Assert.NotNull(_sut);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|