public void JsonAppointmentObjectToJsonTest() { TemplateJson tl = new JsonEveryTimeSlot(); var json = tl.GetJson(new TimeSlot(id, dentist, hour, min, day)); Assert.AreEqual(correctJson, json); }
public void JsonAppointmentObjectToJsonInvalidTest() { bool exception = false; TemplateJson tl = new JsonEveryTimeSlot(); try { var json = tl.GetJson("I am the wrong object"); } catch (InvalidLoginObjectException) { exception = true; } Assert.IsTrue(exception); }
public void JsonAppointmentJsonToObjectInvalidTest() { bool exception = false; var incorrect = "{\"emails\":\"[email protected]\",\"password\":\"Password\"}"; TemplateJson tl = new JsonEveryTimeSlot(); try { var o = tl.GetObject(incorrect) as TimeSlot; } catch (InvalidLoginJsonException) { exception = true; } Assert.IsTrue(exception); }
public void JsonAppointmentJsonToObjectTest() { TemplateJson tl = new JsonEveryTimeSlot(); var o = tl.GetObject(correctJson) as TimeSlot; Assert.AreEqual(id, o.GetID()); var od = o.GetDentist(); Assert.AreEqual(dentist.GetEmail(), od.GetEmail()); Assert.AreEqual(dentist.GetID(), od.GetID()); //Will fail if email and phone not included Assert.AreEqual(dentist.GetName(), od.GetName()); Assert.AreEqual(dentist.GetPhone(), od.GetPhone()); Assert.AreEqual(hour, o.GetHour()); Assert.AreEqual(min, o.GetMin()); Assert.AreEqual(day, o.GetDay()); }