Exemplo n.º 1
0
        public void JsonAppointmentObjectToJsonTest()
        {
            TemplateJson tl   = new JsonAppointmentType();
            var          json = tl.GetJson(new AppointmentType(id, desc, cost));

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

            Assert.AreEqual(id, o.GetID());
            Assert.AreEqual(desc, o.GetDescription());
            Assert.AreEqual(cost, o.GetCost());
        }
Exemplo n.º 3
0
        public void JsonAppointmentObjectToJsonInvalidTest()
        {
            bool         exception = false;
            TemplateJson tl        = new JsonAppointmentType();

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

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

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

            Assert.IsTrue(exception);
        }