Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Mauritz, Falk Marius
SWTII Cal
Commits
58e3b9e8
Commit
58e3b9e8
authored
Jun 11, 2019
by
HellLab
Browse files
Aqueduct
parent
d6c11c16
Changes
7
Hide whitespace changes
Inline
Side-by-side
frontend/lib/src/model/appointment.dart
View file @
58e3b9e8
...
...
@@ -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
"
;
}
}
frontend/lib/src/view/main_component.dart
View file @
58e3b9e8
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'
;
...
...
frontend/lib/src/view/services/appointment_service.dart
View file @
58e3b9e8
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'
;
...
...
frontend/lib/src/view/services/contact_service.dart
View file @
58e3b9e8
import
'dart:async'
;
import
'dart:convert'
;
import
'package:demo/src/model/person.dart'
;
...
...
frontend/lib/src/view/services/person_service.dart
View file @
58e3b9e8
...
...
@@ -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;
}
}*/
}
frontend/test/test.dart
→
frontend/test/test
_model
.dart
View file @
58e3b9e8
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'
);
...
...
frontend/test/test_services.dart
0 → 100644
View file @
58e3b9e8
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment