Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: pkg/unittest/lib/mock.dart

Issue 15069007: Fix the usage instructions for matcher and mock libraries. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/unittest/lib/matcher.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * A simple mocking/spy library. 6 * A simple mocking/spy library.
7 * 7 *
8 * ## Installing ## 8 * ## Installing ##
9 * 9 *
10 * Use [pub][] to install this package. Add the following to your `pubspec.yaml` 10 * Use [pub][] to install this package. Add the following to your `pubspec.yaml`
11 * file. 11 * file.
12 * 12 *
13 * dependencies: 13 * dependencies:
14 * mock: any 14 * unittest: any
15 * 15 *
16 * Then run `pub install`. 16 * Then run `pub install`.
17 * 17 *
18 * For more information, see the 18 * Import this into your Dart code with:
19 * [mock package on pub.dartlang.org](http://pub.dartlang.org/packages/mock). 19 *
20 * import 'package:unittest/mock.dart';
21 *
22 * For more information, see the [unittest package on pub.dartlang.org]
23 * (http://pub.dartlang.org/packages/unittest).
20 * 24 *
21 * ## Using ## 25 * ## Using ##
22 * 26 *
23 * To create a mock objects for some class T, create a new class using: 27 * To create a mock objects for some class T, create a new class using:
24 * 28 *
25 * class MockT extends Mock implements T {}; 29 * class MockT extends Mock implements T {};
26 * 30 *
27 * Then specify the [Behavior] of the Mock for different methods using 31 * Then specify the [Behavior] of the Mock for different methods using
28 * [when] (to select the method and parameters) and then the [Action]s 32 * [when] (to select the method and parameters) and then the [Action]s
29 * for the [Behavior] by calling [thenReturn], [alwaysReturn], [thenThrow], 33 * for the [Behavior] by calling [thenReturn], [alwaysReturn], [thenThrow],
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 } 1544 }
1541 } 1545 }
1542 } 1546 }
1543 1547
1544 /** Clear both logs and behavior. */ 1548 /** Clear both logs and behavior. */
1545 void reset() { 1549 void reset() {
1546 resetBehavior(); 1550 resetBehavior();
1547 clearLogs(); 1551 clearLogs();
1548 } 1552 }
1549 } 1553 }
OLDNEW
« no previous file with comments | « pkg/unittest/lib/matcher.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698