コード例 #1
0
        public void JsonDentistObjectToJsonTest()
        {
            TemplateJson tl   = new JsonDentist();
            var          json = tl.GetJson(new Dentist(id, name, email, phone));

            Assert.AreEqual(correctJson, json);
        }
コード例 #2
0
        private static void GetDentist(int id)
        {
            IRequestResponse irr = new HttpGetDentist();
            TemplateJson     ts  = new JsonDentist();

            irr.SendRequest(id.ToString());
            var json    = irr.GetResponse();
            var objects = ts.GetObject(json);
        }
コード例 #3
0
        public void JsonDentistJsonToObjectTest()
        {
            TemplateJson tl = new JsonDentist();
            var          o  = tl.GetObject(correctJson) as Dentist;

            Assert.AreEqual(id, o.GetID());
            Assert.AreEqual(name, o.GetName());
            Assert.AreEqual(email, o.GetEmail());
            Assert.AreEqual(phone, o.GetPhone());
        }
コード例 #4
0
        public void JsonDentistObjectToJsonInvalidTest()
        {
            bool         exception = false;
            TemplateJson tl        = new JsonDentist();

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

            Assert.IsTrue(exception);
        }
コード例 #5
0
        public void JsonDentistJsonToObjectInvalidTest()
        {
            bool         exception = false;
            var          incorrect = "{\"emails\":\"[email protected]\",\"password\":\"Password\"}";
            TemplateJson tl        = new JsonDentist();

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

            Assert.IsTrue(exception);
        }