dart_mock/test/person_test.dart

37 lines
721 B
Dart
Raw Permalink Normal View History

2023-02-13 11:42:22 +01:00
import 'package:test/test.dart';
import 'package:mock/person.dart';
void main() {
group('Person properties', () {
final Person p1 = Person(1, "Dummy User");
setUp(() {
// runs before each test;
print("Set up");
});
tearDown(() {
// runs after each test;
print("Tear down");
});
test('id', () {
expect(p1.id, 1);
});
test('name', () {
expect(p1.id, 1);
});
});
group('Comparing persons', () {
final Person p1 = Person(1, "One person");
final Person p2 = Person(2, "Another person");
test('Same object', () {
expect(p1 == p1, true);
});
test('Different objects', () {
expect(p1 != p2, true);
});
});
}