Exemplo n.º 1
0
        public void JsonSignUpObjectToJsonTest()
        {
            TemplateJson tl   = new JsonSignUp();
            var          json = tl.GetJson(new SignUp(email, password, reEnteredEmail, reEnteredPassword, phone, firstName, lastName));

            Assert.AreEqual(correctJson, json);
        }
Exemplo n.º 2
0
        public void JsonSignUpJsonToObjectTest()
        {
            TemplateJson tl = new JsonSignUp();
            var          o  = tl.GetObject(correctJson) as SignUp;

            Assert.AreEqual(email, o.GetEmail());
            Assert.AreEqual(password, o.GetPassword());
            Assert.AreEqual(reEnteredPassword, o.GetReEnterPassword());
            Assert.AreEqual(reEnteredEmail, o.GetReEnterEmail());
            Assert.AreEqual(phone, o.GetPhone());
            Assert.AreEqual(firstName, o.GetFirstName());
            Assert.AreEqual(lastName, o.GetLastName());
        }
Exemplo n.º 3
0
        public void JsonSignUpObjectToJsonInvalidTest()
        {
            bool         exception = false;
            TemplateJson tl        = new JsonSignUp();

            try
            {
                var json = tl.GetJson("I am the wrong object");
            }
            catch (InvalidLoginObjectException)
            {
                exception = true;
            }

            Assert.IsTrue(exception);
        }
Exemplo n.º 4
0
        public void JsonSignUpJsonToObjectInvalidTest()
        {
            bool         exception = false;
            var          incorrect = "{\"emails\":\"[email protected]\",\"password\":\"Password\"}";
            TemplateJson tl        = new JsonSignUp();

            try
            {
                var o = tl.GetObject(incorrect) as SignUp;
            }
            catch (InvalidLoginJsonException)
            {
                exception = true;
            }

            Assert.IsTrue(exception);
        }
Exemplo n.º 5
0
        protected override void ThreadMethod()
        {
            try
            {
                var jsonData = new JsonSignUp().GetJson(information);
                var response = PostHttpRequest(new HttpPostSignUp(), jsonData);
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    ThreadComplete(true);
                }
                else
                {
                    ThreadComplete(false);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.StackTrace);

                ThreadComplete(false);
            }
        }