dart_mock/test/business_test.dart

40 lines
925 B
Dart
Raw Normal View History

2023-02-13 11:42:22 +01:00
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);
});
});
});
}