Commit 58e3b9e8 authored by HellLab's avatar HellLab
Browse files

Aqueduct

parent d6c11c16
......@@ -17,7 +17,6 @@ class Appointment {
appointment['location'] as String,
appointment['note'] as String);
List<String> contactCodes = [];
int id;
String name;
int year;
......@@ -53,7 +52,11 @@ class Appointment {
}
bool equals(Appointment app){
return this.toJson() == app.toJson();
return toString() == app.toString();
}
String toString(){
return "ID: $id Name: $name Date: $date Time: $time Duration: $duration Location: $location Note: $note";
}
}
import 'dart:core' as prefix0;
import 'dart:core';
import 'dart:html';
import "dart:html";
import 'package:angular/angular.dart';
import 'package:angular_router/angular_router.dart';
import 'package:demo/src/view/routes/routes.dart';
......
import 'dart:async';
import 'dart:convert';
import 'dart:html';
import 'dart:html';
import 'package:demo/src/view/main_component.dart';
import 'package:http/http.dart';
......
import 'dart:async';
import 'dart:convert';
import 'package:demo/src/model/person.dart';
......
......@@ -44,23 +44,4 @@ class UserService {
return User.fromJson(_extractData(response) as Map<String, dynamic>);
}
/*Future<User> getLoginEmail(String password, String email) async {
final Response response = await _http.get('$_userUrl/$password/$email');
return User.fromJson(_extractData(response) as Map<String, dynamic>);
}
Future<User> getLoginNickname(String password, String nickname) async {
final Response response = await _http.get('$_userUrl/$password/$nickname');
return User.fromJson(_extractData(response) as Map<String, dynamic>);
}*/
/*///Updatet einen bereits existierenden User
Future<User> update(User user) async {
for (var mockUser in mockUsers) {
if (mockUser.contactCode == user.contactCode) {
mockUser = user;
}
return mockUser;
}
}*/
}
import 'package:demo/src/view/services/appointment_service.dart';
import 'package:demo/src/view/services/person_service.dart';
import 'package:test/test.dart';
import 'package:demo/src/model/day.dart';
import 'package:demo/src/model/month.dart';
import 'package:demo/src/model/appointment.dart';
import 'package:demo/src/model/person.dart';
Future main() {
void main() {
Day day;
Day day2;
......@@ -49,7 +48,6 @@ Future main() {
///Tests for appointment.dart
List<Appointment> appointments;
AppointmentService appointmentService;
Appointment appo =
Appointment(1, "Abifaier", 2019, 6, 4, "2:30", "", "Lübeck", "hi");
Appointment json = Appointment.zero();
......@@ -58,35 +56,7 @@ Future main() {
expect(appo.equals(Appointment.fromJson(appo.toJson())), true);
});
///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;
User user = User(1,'CC123', 'Hellbender', 'Schindler', 'Laurenz',
'Hallo@myWebmail.com', 'dasisteinschlechtesPasswort', '016331742');
......
import 'package:demo/src/view/services/appointment_service.dart';
import 'package:test/test.dart';
import 'package:demo/src/model/appointment.dart';
void main(){
AppointmentService appointmentService;
List<Appointment> appointments;
Appointment appo =
Appointment(1, "Abifaier", 2019, 6, 4, "2:30", "", "Lübeck", "hi");
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);
});
}
\ No newline at end of file
Supports Markdown
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