dart_mock/test/person_test.dart

37 lines
721 B
Dart

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);
});
});
}