Exemplo n.º 1
0
        public void GetAllTest()
        {
            IList <IAccount> accounts = AccountGateway.GetAll();

            Process.Start(AccountGateway.AccountSettingPath);

            foreach (IAccount a in accounts)
            {
                Console.WriteLine("Account(" + accounts.IndexOf(a) + ")");
                PrintAccount(a);
            }
        }
Exemplo n.º 2
0
        public void AddTest()
        {
            IAccount a = AccountGateway.Add("test1", "test1", "weibo.com", "*****@*****.**");
            IAccount b = AccountGateway.Add("test2", "test2", "weibo.com", "*****@*****.**", true);

            Process.Start(AccountGateway.AccountSettingPath);

            IList <IAccount> all = AccountGateway.GetAll();

            IAccount actual = null;

            foreach (IAccount account in all)
            {
                if (account.Id == a.Id || account.Id == b.Id)
                {
                    actual = account;
                }
                else
                {
                    actual = null;
                }

                if (actual != null)
                {
                    if (account.Id == a.Id)
                    {
                        Assert.IsFalse(actual.IsDefault);
                    }
                    else
                    {
                        Assert.IsTrue(actual.IsDefault);
                    }

                    Console.WriteLine("Found Account({0}) {1} default account", actual.Id == a.Id ? "a" : "b",
                                      actual.IsDefault ? "is" : "is not");

                    PrintAccount(account);
                }
            }

            IAccount actual2 = AccountGateway.GetDefault();

            Console.WriteLine("Default Account");
            PrintAccount(actual2);

            Assert.AreEqual(b.Id, actual2.Id);
        }
Exemplo n.º 3
0
        public void UpdateTest()
        {
            IAccount a = AccountGateway.GetAll().FirstOrDefault();

            Console.WriteLine("Old Values:");
            PrintAccount(a);

            a.Host      = "www.test.com";
            a.UserName  = "******";
            a.IsDefault = true;
            a.Password  = "******";

            IAccount b = AccountGateway.Update(a);

            Console.WriteLine("New Values:");
            PrintAccount(b);

            Assert.AreEqual(a.Id, b.Id);
        }