Commit 829a6fb5 authored by HellLab's avatar HellLab
Browse files

update test

parent d989003f
......@@ -7,7 +7,7 @@ import 'package:demo/src/model/month.dart';
import 'package:demo/src/model/appointment.dart';
import 'package:demo/src/model/person.dart';
Future main() async {
Future main() {
Day day;
Day day2;
......@@ -48,21 +48,43 @@ Future main() async {
});
///Tests for appointment.dart
List<Appointment> appointments;
AppointmentService appointmentService;
Appointment appo =
Appointment(1, "Abifaier", 2019, 6, 4, "2", "4", "Lübeck", "hi");
Appointment(1, "Abifaier", 2019, 6, 4, "2:30", "", "Lübeck", "hi");
Appointment json = Appointment.zero();
test("Appointment appointment.fromJson", () {
expect(appo.equals(Appointment.fromJson(appo.toJson())), true);
});
await appointmentService.update(appo);
List<Appointment> appointments= await appointmentService.getByDate(appo.year, appo.month,appo.day);
test("AppointmentService.update appointment.getByDate",() async {
///Datenbank tests für AppointmentService
test("AppointmentService.creat appointment.getByDate",() async {
await appointmentService.create(appo);
appointments = await appointmentService.getByDate(appo.year, appo.month,appo.day);
expect(appointments.contains(appo), true);
});
test("AppointmentService.update appointment.getByDate",() async {
appointments = await appointmentService.getByDate(appo.year, appo.month,appo.day);
int length = appointments.length;
await appointmentService.update(Appointment(1, "KiezTour", 2019, 6, 4, "22:30", "", "Hamburg", "Lass mal nicht so spät anfangen."));
appointments = await appointmentService.getByDate(appo.year, appo.month,appo.day);
expect(appointments.length, length);
});
test("AppointmentService.delet getAll",() async {
appointments = await appointmentService.getAll();
int length = appointments.length;
appointmentService.delete(appointments.last.id);
appointments = await appointmentService.getAll();
expect(appointments.length + 1, length);
});
test("AppointmentService.creat search",() async {
await appointmentService.create(appo);
appointments = await appointmentService.search(appo.name);
expect(appointments.contains(appo), true);
});
///Tests for person.dart
UserService userService;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment