Ejemplo n.º 1
0
        public void CreateAccountTest()
        {
            //signup
            string email = GetNewEmailAddress();

            WebAccountService.TransitAccount t_instance = new WebAccountService.TransitAccount();
            t_instance.Birthday = DateTime.UtcNow.AddYears(-10);
            t_instance.Name     = GetNewString();
            t_instance.Password = GetNewString();
            t_instance.Id       = EndPoint.CreateAccount(string.Empty, email, t_instance);
            Console.WriteLine("Created account: {0}", t_instance.Id);
            Assert.IsTrue(t_instance.Id > 0);
            // login
            string ticket = EndPoint.Login(email, t_instance.Password);

            Assert.IsFalse(string.IsNullOrEmpty(ticket));
            // retreive
            WebAccountService.TransitAccount t_instance2 = EndPoint.GetAccountById(ticket, t_instance.Id);
            Console.WriteLine("Retreived account: {0}", t_instance2.Id);
            Assert.AreEqual(t_instance.Id, t_instance2.Id);
            // update
            t_instance2.Name = GetNewString();
            EndPoint.CreateOrUpdateAccount(ticket, t_instance2);
            // object may be cached, use admin ticket
            string ticket2 = EndPoint.Login("*****@*****.**", "password");

            // check that the name was updated
            WebAccountService.TransitAccount t_instance3 = EndPoint.GetAccountById(ticket2, t_instance.Id);
            Console.WriteLine("Retreived account: {0}", t_instance3.Id);
            Assert.AreEqual(t_instance.Id, t_instance3.Id);
            Assert.AreEqual(t_instance2.Name, t_instance3.Name);
            // delete
            EndPoint.DeleteAccount(ticket, t_instance.Id);
            Console.WriteLine("Deleted account: {0}", t_instance.Id);
        }
Ejemplo n.º 2
0
        public void GetAccountTest()
        {
            WebAccountService.TransitAccount t_instance = GetTransitInstance();
            string email = GetNewEmailAddress();
            int    id    = EndPoint.CreateAccount(string.Empty, email, t_instance);

            Assert.IsTrue(id > 0);
            string ticket = EndPoint.Login(email, t_instance.Password);
            int    id2    = EndPoint.GetAccountId(ticket);

            Assert.AreEqual(id, id2);
            WebAccountService.TransitAccount t_instance2 = EndPoint.GetAccount(ticket, true);
            Assert.AreEqual(t_instance2.Id, id);
            Assert.AreEqual(t_instance2.Name, t_instance.Name);
        }
Ejemplo n.º 3
0
        public void SetCountryStateTest()
        {
            WebAccountService.TransitAccount t_instance = GetTransitInstance();
            string email = GetNewEmailAddress();

            t_instance.Id = EndPoint.CreateAccount(string.Empty, email, t_instance);
            Assert.IsTrue(t_instance.Id > 0);
            string ticket = EndPoint.Login(email, t_instance.Password);

            t_instance.State   = "New York";
            t_instance.Country = "United States";
            EndPoint.CreateOrUpdateAccount(ticket, t_instance);
            WebAccountService.TransitAccount t_instance2 = EndPoint.GetAccount(ticket, true);
            Assert.AreEqual(t_instance2.State, t_instance.State);
            Assert.AreEqual(t_instance2.Country, t_instance.Country);
            t_instance.State   = string.Empty;
            t_instance.Country = "New Zealand";
            EndPoint.CreateOrUpdateAccount(ticket, t_instance);
            WebAccountService.TransitAccount t_instance3 = EndPoint.GetAccount(ticket, true);
            Assert.AreEqual(t_instance3.State, t_instance.State);
            Assert.AreEqual(t_instance3.Country, t_instance.Country);
        }