-
Notifications
You must be signed in to change notification settings - Fork 0
/
my_fake.dart
36 lines (29 loc) · 875 Bytes
/
my_fake.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import 'package:mock_exceptions/mock_exceptions.dart';
class MyFake {
String _name = 'name';
String get name {
maybeThrowException(this, Invocation.getter(#name));
return _name;
}
set name(String value) {
maybeThrowException(this, Invocation.setter(#name, value));
_name = value;
}
String get description {
maybeThrowException(this, Invocation.getter(#description));
return 'description';
}
String doSomething(String input) {
maybeThrowException(this, Invocation.method(#doSomething, [input]));
return 'it works';
}
int add({required int i1, required int i2}) {
maybeThrowException(
this, Invocation.method(#add, null, {#i1: i1, #i2: i2}));
return i1 + i2;
}
List<T> makeList<T>() {
maybeThrowException(this, Invocation.genericMethod(#makeList, [T], null));
return List<T>.empty();
}
}