cpd_2022_zi/lib/mock/db_mock.dart

44 lines
1.1 KiB
Dart
Raw Normal View History

import 'package:smoke_cess_app/interface/db_record.dart';
import 'package:smoke_cess_app/models/mood.dart';
import 'package:smoke_cess_app/models/sleep.dart';
import 'package:smoke_cess_app/services/database_service.dart';
import 'package:sqflite_common/sqlite_api.dart';
class DatabaseMock implements DatabaseService {
static final DatabaseMock _databaseMock = DatabaseMock._internal();
factory DatabaseMock() {
return _databaseMock;
}
DatabaseMock._internal();
final List<Mood> _moodRecords = [];
final List<Sleep> _sleepRecords = [];
final List<DatabaseRecord> _workoutRecords = [];
@override
Future<int> addMood(Mood mood) {
_moodRecords.add(mood);
return Future.value(1);
}
@override
Future<int> addSleep(Sleep sleep) {
_sleepRecords.add(sleep);
return Future.value(1);
}
@override
// TODO: implement database
Future<Database> get database => DatabaseService.instance.database;
@override
Future<List<Mood>> getMoodRecords() {
return Future.value(_moodRecords);
}
@override
Future<List<Sleep>> getSleepRecords() {
return Future.value(_sleepRecords);
}
}