Exemplo n.º 1
0
        public async Task RegisterTransaction_WhenTransactionIdAlreadyExists_ShouldThrowUniqueTransactionIdException()
        {
            var transactionId = DateTime.Now.Ticks;
            var nets          = new Nets(MerchantId, Token, new HttpClientApiCaller(), Endpoints.Test);
            await nets.RegisterAsync("12345", 500, "NOK", new RegisterOptions
            {
                TransactionId = transactionId.ToString(),
                RedirectUrl   = new Uri("http://localhost/Test")
            });

            await Assert.ThrowsAsync <UniqueTransactionIdException>(() => nets.RegisterAsync("12345", 500, "NOK", new RegisterOptions
            {
                TransactionId = transactionId.ToString(),
                RedirectUrl   = new Uri("http://localhost/Test")
            }));
        }
Exemplo n.º 2
0
 public async Task CreateOrderWithWrongTokens()
 {
     var nets = new Nets("foo", "bar", new HttpClientApiCaller(), Endpoints.Test);
     await Assert.ThrowsAsync <AuthenticationException>(async() =>
                                                        await nets.RegisterAsync("12345", 100, "NOK", new RegisterOptions
     {
         RedirectUrl = new Uri("http://localhost/Test")
     }));
 }
Exemplo n.º 3
0
        public async Task CreateOrderSuccessFully()
        {
            var nets          = new Nets(MerchantId, Token, new HttpClientApiCaller(), Endpoints.Test);
            var transactionId = await nets.RegisterAsync("12345", 100, "NOK", new RegisterOptions
            {
                RedirectUrl = new Uri("http://localhost/Test")
            });

            Assert.False(string.IsNullOrEmpty(transactionId));
        }
Exemplo n.º 4
0
        public async Task CreateAndQueryOrder()
        {
            var nets          = new Nets(MerchantId, Token, new HttpClientApiCaller(), Endpoints.Test);
            var transactionId = await nets.RegisterAsync("12345", 500, "NOK", new RegisterOptions
            {
                RedirectUrl = new Uri("http://localhost/Test")
            });

            var data = await nets.QueryAsync(transactionId);

            Assert.Equal(500, data.OrderInformation.Total);
            Assert.Equal("NOK", data.OrderInformation.Currency);
        }