public void BeforeScenarioSetUp()
        {
            var fakeClientConfiguration = A.Fake <IAcquiringBankClientConfiguration>();

            _fakePaymentRepository     = A.Fake <IPaymentRepository>();
            _fakeAcquiringBankProvider = A.Fake <IAcquiringBankProvider>();

            var webHostBuilder = new WebHostBuilder()
                                 .UseStartup <Startup>()
                                 .ConfigureTestServices(services =>
            {
                services.Replace(new ServiceDescriptor(typeof(IAcquiringBankClientConfiguration), sp => fakeClientConfiguration, ServiceLifetime.Singleton));
                services.Replace(new ServiceDescriptor(typeof(IPaymentRepository), sp => _fakePaymentRepository, ServiceLifetime.Singleton));
                services.Replace(new ServiceDescriptor(typeof(IAcquiringBankProvider), sp => _fakeAcquiringBankProvider, ServiceLifetime.Singleton));
            });

            var testServer = new TestServer(webHostBuilder);

            _testHttpClient = testServer.CreateClient();
        }
Exemplo n.º 2
0
 public PaymentService(IPaymentRepository paymentRepository, IAcquiringBankProvider acquiringBankProvider)
 {
     _paymentRepository     = paymentRepository;
     _acquiringBankProvider = acquiringBankProvider;
 }