public void JsonAppointmentObjectToJsonTest() { TemplateJson tl = new JsonAppointmentType(); var json = tl.GetJson(new AppointmentType(id, desc, cost)); Assert.AreEqual(correctJson, json); }
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()); }
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); }
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); }