public void JsonDentistObjectToJsonTest() { TemplateJson tl = new JsonDentist(); var json = tl.GetJson(new Dentist(id, name, email, phone)); Assert.AreEqual(correctJson, json); }
private static void GetDentist(int id) { IRequestResponse irr = new HttpGetDentist(); TemplateJson ts = new JsonDentist(); irr.SendRequest(id.ToString()); var json = irr.GetResponse(); var objects = ts.GetObject(json); }
public void JsonDentistJsonToObjectTest() { TemplateJson tl = new JsonDentist(); var o = tl.GetObject(correctJson) as Dentist; Assert.AreEqual(id, o.GetID()); Assert.AreEqual(name, o.GetName()); Assert.AreEqual(email, o.GetEmail()); Assert.AreEqual(phone, o.GetPhone()); }
public void JsonDentistObjectToJsonInvalidTest() { bool exception = false; TemplateJson tl = new JsonDentist(); try { var json = tl.GetJson("I am the wrong object"); } catch (InvalidLoginObjectException) { exception = true; } Assert.IsTrue(exception); }
public void JsonDentistJsonToObjectInvalidTest() { bool exception = false; var incorrect = "{\"emails\":\"[email protected]\",\"password\":\"Password\"}"; TemplateJson tl = new JsonDentist(); try { var o = tl.GetObject(incorrect) as Dentist; } catch (InvalidLoginJsonException) { exception = true; } Assert.IsTrue(exception); }