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); }
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()); }
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); }
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); } }