コード例 #1
0
        public async Task CreateMerchant()
        {
            var request        = MerchantControllerTests.GetMerchantRequest();
            var merchantCreate = await MerchantClient.CreateMerchantAsync(request);

            Assert.AreEqual(1L, merchantCreate.Id);
        }
コード例 #2
0
ファイル: PaymentTests.cs プロジェクト: 2ooom/payment-gateway
        public async Task Setup()
        {
            Factory    = new PaymentGatewayServiceFactory <Startup>();
            HttpClient = Factory.CreateClient();
            // Create merchant
            Merchant       = MerchantControllerTests.GetMerchantRequest();
            MerchantClient = new MerchantsClient(HttpClient.BaseAddress.ToString(), HttpClient);

            // Authenticate Merchant
            var merchantResponse = await MerchantClient.CreateMerchantAsync(Merchant);

            MerchantId = merchantResponse.Id;
        }
コード例 #3
0
        public async Task AuthenticateMerchant()
        {
            var expectedExpiryDate = DateTime.UtcNow.AddDays(7);
            var request            = MerchantControllerTests.GetMerchantRequest();
            await MerchantClient.CreateMerchantAsync(request);

            var jwtResponse = await MerchantClient.AuthenticateAsync(new AuthenticationRequest
            {
                Login    = request.Login,
                Password = request.Password,
            });

            Assert.IsTrue(jwtResponse.JwtToken.Length > 0);
            Assert.IsTrue(jwtResponse.Expires > expectedExpiryDate);
        }