Пример #1
0
        public void TestGetValidCards_Success()
        {
            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi = new Providers.Cards.Cal.CalApi(credentials);
            var cards  = calApi.GetCards();

            calApi.Dispose();

            Assert.True(cards.BankAccounts.First().Cards.Count() == 2);
        }
Пример #2
0
        public void TestGetBankDebits_Fail()
        {
            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi    = new Providers.Cards.Cal.CalApi(credentials);
            var exception = Assert.Throws <Exception>(() =>
                                                      calApi.GetBankDebits("0052748202617", "01981802", DateTime.Now.AddMonths(-1), DateTime.Now));

            calApi.Dispose();

            Assert.NotNull(exception);
            Assert.StartsWith("Did not succeed to fetch debits for card 01981802", exception.Message, StringComparison.CurrentCultureIgnoreCase);
        }
Пример #3
0
        public void TestGetBankDebits_Success()
        {
            InitializeMapper();

            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi = new Providers.Cards.Cal.CalApi(credentials);
            var debits = calApi.GetBankDebits("00527482012617", "01981802", DateTime.Now.AddMonths(-1), DateTime.Now);

            calApi.Dispose();

            Assert.True(debits.Any());
        }
Пример #4
0
        public void TestDisposeApi_Success()
        {
            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi = new Providers.Cards.Cal.CalApi(credentials);

            try
            {
                calApi.Dispose();
            }
            catch (Exception ex)
            {
                Assert.Null(ex);
            }
        }
Пример #5
0
        public void TestGetTransactionDetails_Failed()
        {
            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi       = new Providers.Cards.Cal.CalApi(credentials);
            var transactions = calApi.GetTransactions("01981802", DateTime.Now.AddMonths(-1), DateTime.Now).ToList();

            var transactionId = transactions.First().Id.Substring(1);
            var numerator     = transactions.First().Numerator;

            var exception = Assert.Throws <Exception>(() => calApi.GetTransactionDetails(transactionId, numerator));

            calApi.Dispose();

            Assert.NotNull(exception);
        }
Пример #6
0
        public void TestGetTransactions_Success()
        {
            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi       = new Providers.Cards.Cal.CalApi(credentials);
            var transactions = calApi.GetTransactions("01981802", DateTime.Now.AddMonths(-1), DateTime.Now).ToList();

            calApi.Dispose();

            Assert.True(transactions.Any());
            foreach (var transaction in transactions)
            {
                Assert.NotEmpty(transaction.Id);
                Assert.NotEmpty(transaction.Currency);
                Assert.NotEmpty(transaction.CurrentPayment);
                Assert.NotEmpty(transaction.Date);
                Assert.NotEmpty(transaction.DebitDate);
                //Assert.NotEmpty(transaction.Notes);
                //Assert.NotEmpty(transaction.Comments);
            }
        }
Пример #7
0
        public void TestGetTransactionDetails_Success()
        {
            var credentials = new Dictionary <string, string> {
                { "username", "YURIYK81" }, { "password", "2w3e4r5t" }
            };
            var calApi       = new Providers.Cards.Cal.CalApi(credentials);
            var transactions = calApi.GetTransactions("01981802", DateTime.Now.AddMonths(-1), DateTime.Now).ToList();

            foreach (var transaction in transactions)
            {
                var transactionId = transaction.Id;
                var numerator     = transaction.Numerator;
                var details       = calApi.GetTransactionDetails(transactionId, numerator);

                Assert.NotNull(details);
                Assert.NotNull(details.Data);
                Assert.NotNull(details.Data.MerchantDetails);
                //Assert.NotNull(details.Data.MerchantDetails.Address);
                //Assert.NotNull(details.Data.MerchantDetails.SectorName);
            }

            calApi.Dispose();
        }