public void JsonAppointmentsObjectToJsonTest() { TemplateJson tl = new JsonAppointments(); var json = tl.GetJson(app); Assert.AreEqual(testJson, json); }
public void JsonAppointmentsJsonToObjectTest() { TemplateJson tl = new JsonAppointments(); var o = tl.GetObject(correctJson) as List <Appointment>; Assert.AreEqual(idJson, o[0].GetID()); Assert.AreEqual(ed, o[0].GetExpectedDate()); }
public void JsonAppointmentsObjectToJsonInvalidTest() { bool exception = false; TemplateJson tl = new JsonAppointments(); try { var json = tl.GetJson("I am the wrong object"); } catch (InvalidLoginObjectException) { exception = true; } Assert.IsTrue(exception); }
public void JsonAppointmentsJsonToObjectInvalidTest() { bool exception = false; var incorrect = "{\"emails\":\"[email protected]\",\"password\":\"Password\"}"; TemplateJson tl = new JsonAppointments(); try { var o = tl.GetObject(incorrect) as List <Appointment>; } catch (Exception) { exception = true; } Assert.IsTrue(exception); }
protected override void ThreadMethod() { try { var response = GetJsonResponse(new JsonAppointments(), new HttpGetAppointments(), information); var appointmentJson = new JsonAppointments(); appointment = appointmentJson.GetObject(response) as List <Appointment>; ThreadComplete(true); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.StackTrace); appointment = null; ThreadComplete(false); } }
public static void Main(string[] args) { var helloIAm = new CP2013_WordOfMouth.DTO.AppointmentType(1, "Clean my teeth", 100); var jsonApointment = new JsonAppointmentAddType().GetJson(helloIAm); var test = PostRequests(new HttpPostAddAppointmentType(), jsonApointment); var Login = new Login("*****@*****.**", "Password"); var json = new JsonLogin().GetJson(Login); var something = PostRequests(new HttpPostLogin(), json); var newSession = new JsonSession().GetObject(something) as Session; var dentistser = GetRequests(new HttpGetAllDentist(), new JsonAllDentists(), "") as List <Dentist>; var allAvaliable = GetRequests(new HttpGetAllAvaliableTimes(), new JsonDentistTimeSlots(), ""); // foreach (var d in dentistser) // { var stuffed = PostRequests(new HttpGetBookingsForDentist(), 2.ToString()); var objectsAreGood = new JsonAppointments().GetObject(stuffed) as List <Appointment>; // } var dentistperson = new Dentist(0, "Dentist New", "*****@*****.**", "0412345678"); var jd = new JsonDentistEditAdd(); var json2 = jd.GetJson(dentistperson); var stuff = PostRequests(new HttpPostAddDentist(), json2); dentistser = GetRequests(new HttpGetAllDentist(), new JsonAllDentists(), "") as List <Dentist>; var i = dentistser.Count - 1; dentistperson = new Dentist(i, "Dentist New", "*****@*****.**", "0412345678"); jd = new JsonDentistEditAdd(); json2 = jd.GetJson(dentistperson); stuff = PostRequests(new HttpPostEditDentist(), json2); GetRequests(new HttpGetDentist(), new JsonDentist(), 1.ToString()); GetRequests(new HttpGetAppointments(), new JsonAppointments(), newSession.GetSessionID().ToString()); var timeSlots = GetRequests(new HttpGetDentistTimeSlots(), new JsonDentistTimeSlots(), 2.ToString()); var apps = GetRequests(new HttpGetAllAppointmentTypes(), new JsonAllAppointmentTypes(), ""); var deleteAppointment = new HttpPostDeleteAppointment(); deleteAppointment.SendRequest(1.ToString()); var response = deleteAppointment.GetResponse(); //var Login = new Login("*****@*****.**", "Password"); //var json = new JsonLogin().GetJson(Login); PostRequests(new HttpPostDeleteDentist(), 37.ToString()); #region OLDMAIN var login = new OldLogin("*****@*****.**", "Password"); var session = rr.Login(login); var dentists = rr.GetAllDentists(); var dentist = rr.GetDentist(dentists[0].id); // var timeSlots = rr.GetAllTimeSlots(); Console.WriteLine(timeSlots); rr.GetTimeSlotsForDentist(dentists[0].id); Console.WriteLine(dentists); fileHandler = new MOCKFileHandler(); var key = GetStringFromOutput(MENU); while (key != "q") { switch (key) { case "1": UserUI(); break; case "2": AdminUI(); break; default: Console.WriteLine("unknown error"); break; } key = GetStringFromOutput(MENU); } #endregion }