Feature/widget testing (#8)
* Configured iOS Build * Created ProgressListTile widget * Created MaterialTesterWidget * Created String Methods for Testing in ProgressListTile * Created ProgressListTileStrings class * Using Progress List Tile * Created Progress List View * Created Progress List Tile currently, future and past test. * Created Progress List View one and five Time Progresses test. Signed-off-by: Andreas Fahrecker <AndreasFahrecker@gmail.com>
This commit is contained in:
committed by
GitHub
parent
90f2998088
commit
fc35476503
@ -14,5 +14,18 @@ class TimeProgressStartTimeIsNotBeforeEndTimeException implements Exception {
|
||||
this.startTime, this.endTime);
|
||||
|
||||
String errMsg() =>
|
||||
"The Start Time has to be before the end time. Therefore these values are invalid: Start Time: $startTime EndTime: $endTime";
|
||||
"The Start Time has to be before the end time. Therefore these values are"
|
||||
" invalid: Start Time: $startTime EndTime: $endTime";
|
||||
}
|
||||
|
||||
class TimeProgressHasStartedException implements Exception {
|
||||
String errMsg() =>
|
||||
"This TimeProgress has started. Therefore all calculation, which assume, "
|
||||
"that the progress hasn't started yet can't be performed";
|
||||
}
|
||||
|
||||
class TimeProgressHasNotEndedException implements Exception {
|
||||
String errMsg() =>
|
||||
"This TimeProgress hasn't ended. Therefore all calculation, which assume,"
|
||||
" that the progress has ended already can't be performed";
|
||||
}
|
||||
|
@ -47,9 +47,19 @@ class TimeProgress {
|
||||
bool hasStarted() =>
|
||||
DateTime.now().millisecondsSinceEpoch > startTime.millisecondsSinceEpoch;
|
||||
|
||||
int daysTillStart() {
|
||||
if (hasStarted()) throw new TimeProgressHasStartedException();
|
||||
return startTime.difference(DateTime.now()).inDays;
|
||||
}
|
||||
|
||||
bool hasEnded() =>
|
||||
DateTime.now().millisecondsSinceEpoch > endTime.millisecondsSinceEpoch;
|
||||
|
||||
int daysSinceEnd() {
|
||||
if (!hasEnded()) throw new TimeProgressHasNotEndedException();
|
||||
return DateTime.now().difference(endTime).inDays;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
id.hashCode ^ name.hashCode ^ startTime.hashCode ^ endTime.hashCode;
|
||||
|
Reference in New Issue
Block a user