Example #1
0
 public void GetOrganizationsTest()
 {
     using (JKEFactory factory = ServiceManager.CreateFactory())
     {
         IJKEService            target        = factory.CreateChannel();
         OrganizationResource[] organizations = target.GetOrganizations();
         Assert.IsNotNull(organizations);
         Assert.AreEqual(4, organizations.Length);
     }
 }
        public AccountPage(WizardData wizardData)
        {
            InitializeComponent();

            // Bind wizard state to UI
            this.DataContext = wizardData;
            try
            {
                IJKEService            channel = ServiceManager.GetChannel();
                OrganizationResource[] orgs    = channel.GetOrganizations();
                this.OrganizationsComboBox.ItemsSource = orgs;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #3
0
        public void PostTransactionTest()
        {
            using (JKEFactory factory = ServiceManager.CreateFactory())
            {
                IJKEService target = factory.CreateChannel();
                string      userId = "jbrown";

                AccountResource[] accounts = target.GetUserAccounts(userId);
                Assert.IsNotNull(accounts);
                Assert.IsTrue(accounts.Length > 0);
                AccountResource account = accounts[0];

                OrganizationResource[] organizations = target.GetOrganizations();
                Assert.IsNotNull(organizations);
                Assert.IsTrue(organizations.Length > 0);
                OrganizationResource organization = organizations[0];

                TransactionResource[] transactions = target.GetTransactionsForAccount(userId, account.Type);
                Assert.IsNotNull(transactions);
                int before = transactions.Length;

                double percentage = 2;
                double amount     = account.Dividends * percentage / 100;

                string today = DateTime.Now.ToShortDateString();

                TransactionResource newTransaction = target.PostTransaction(account.AccountNumber, organization.Name, today, percentage);
                Assert.IsNotNull(newTransaction);

                Assert.AreEqual(amount, newTransaction.Amount);
                Assert.AreEqual(account.AccountNumber, newTransaction.AccountNumber);

                DateTime newDate = Convert.ToDateTime(newTransaction.Date, CultureInfo.InvariantCulture);
                Assert.AreEqual(today, newDate.ToShortDateString());

                Assert.AreEqual(organization.Name, newTransaction.Source);
                Assert.AreEqual(account.Balance - amount, newTransaction.PostBalance);

                transactions = target.GetTransactionsForAccount(userId, account.Type);
                Assert.IsNotNull(transactions);
                int after = transactions.Length;

                Assert.AreEqual(before + 1, after);
            }
        }