Esempio n. 1
0
        public void JsonAddBookingObjectToJsonTest()
        {
            TemplateJson tl       = new JsonAddBooking();
            var          dentists = new Booking(sesseionID, apt, den, day, time);
            var          json     = tl.GetJson(dentists);

            Assert.AreEqual(correctJson, json);
        }
Esempio n. 2
0
        public void JsonAddBookingJsonToObjectTest()
        {
            TemplateJson tl = new JsonAddBooking();
            var          o  = tl.GetObject(correctJson) as Booking;

            Assert.AreEqual(sesseionID, o.GetSessionID());
            Assert.AreEqual(apt, o.GetAppointmentType());
            Assert.AreEqual(den, o.GetDentist());
            Assert.AreEqual(day, o.GetDay());
            Assert.AreEqual(time, o.GetTime());
        }
Esempio n. 3
0
        public void JsonAddBookingObjectToJsonInvalidTest()
        {
            bool         exception = false;
            TemplateJson tl        = new JsonAddBooking();

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

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

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

            Assert.IsTrue(exception);
        }
        protected override void ThreadMethod()
        {
            try
            {
                var jsonData = new JsonAddBooking().GetJson(information);
                var response = PostHttpRequest(new HttpPostAnyDentistBooking(), jsonData);

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    ThreadComplete(true);
                }
                else
                {
                    ThreadComplete(false);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.StackTrace);
                ThreadComplete(false);
            }
        }