Beispiel #1
0
        public void JsonAppointmentJsonToObjectTest()
        {
            TemplateJson tl  = new JsonDentistTimeSlots();
            var          o   = tl.GetObject(json) as List <TimeSlot>;
            var          one = o[0];

            Assert.AreEqual(2, one.GetDay());
            Assert.AreEqual(8, one.GetHour());
            Assert.AreEqual(1, one.GetID());
            Assert.AreEqual(0, one.GetMin());
            Assert.AreEqual("*****@*****.**", one.GetDentist().GetEmail());
            Assert.AreEqual(1, one.GetDentist().GetID());
            Assert.AreEqual("Dr. Smile", one.GetDentist().GetName());
            Assert.AreEqual("04 2977 9888", one.GetDentist().GetPhone());
        }
Beispiel #2
0
        public void JsonAppointmentObjectToJsonInvalidTest()
        {
            bool         exception = false;
            TemplateJson tl        = new JsonDentistTimeSlots();

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

            Assert.IsTrue(exception);
        }
Beispiel #3
0
        public void JsonAppointmentJsonToObjectInvalidTest()
        {
            bool         exception = false;
            var          incorrect = "{\"emails\":\"[email protected]\",\"password\":\"Password\"}";
            TemplateJson tl        = new JsonDentistTimeSlots();

            try
            {
                var o = tl.GetObject(incorrect) as List <TimeSlot>;
            }
            catch (Exception)
            {
                exception = true;
            }

            Assert.IsTrue(exception);
        }
        protected override void ThreadMethod()
        {
            try
            {
                var response     = GetJsonResponse(new JsonDentistTimeSlots(), new HttpGetDentistTimeSlots(), information);
                var dentistTimes = new JsonDentistTimeSlots();

                timeslots = dentistTimes.GetObject(response) as List <TimeSlot>;
                ThreadComplete(true);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.StackTrace);

                timeslots = null;
                ThreadComplete(false);
            }
        }
Beispiel #5
0
 public void JsonAppointmentObjectToJsonTest()
 {
     TemplateJson tl = new JsonDentistTimeSlots();
     //var json = tl.GetJson(new TimeSlot(id, dentist, hour, min, day));
     //Assert.AreEqual(correctJson, json);
 }