40 lines
925 B
Dart
40 lines
925 B
Dart
|
import 'package:mock/person_data_access_map.dart';
|
||
|
import 'package:test/test.dart';
|
||
|
import 'package:mock/person.dart';
|
||
|
import 'package:mock/business.dart';
|
||
|
|
||
|
class TestPersonBackend extends PersonDataAccessMap {
|
||
|
TestPersonBackend() {
|
||
|
store(Person(1, "Mr. X"));
|
||
|
store(Person(2, "Ms. Y"));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void main() {
|
||
|
group('Backend', () {
|
||
|
PersonDataAccessMap? backend;
|
||
|
|
||
|
tearDownAll(() {
|
||
|
backend?.close();
|
||
|
});
|
||
|
|
||
|
group('Empty', () {
|
||
|
final PersonDataAccessMap backend = PersonDataAccessMap();
|
||
|
final Business business = Business(backend);
|
||
|
|
||
|
test('Initial size', () {
|
||
|
expect(business.getAllPersons().length, 0);
|
||
|
});
|
||
|
});
|
||
|
|
||
|
group('Filled', () {
|
||
|
final PersonDataAccessMap backend = TestPersonBackend();
|
||
|
final Business business = Business(backend);
|
||
|
|
||
|
test('Initial size', () {
|
||
|
expect(business.getAllPersons().length, 2);
|
||
|
});
|
||
|
});
|
||
|
});
|
||
|
}
|