| OLD | NEW |
| 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 library mock_test; | 5 library mock_test; |
| 6 import 'package:unittest/unittest.dart'; | 6 import 'package:unittest/unittest.dart'; |
| 7 import 'package:unittest/mock.dart'; | 7 import 'package:unittest/mock.dart'; |
| 8 | 8 |
| 9 class MockList extends Mock implements List { | 9 class MockList extends Mock implements List { |
| 10 } | 10 } |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 | 711 |
| 712 m.when(callsTo("foo", "bar", "mock")).alwaysReturn("C"); | 712 m.when(callsTo("foo", "bar", "mock")).alwaysReturn("C"); |
| 713 m.when(callsTo("foo")).thenReturn("A"); | 713 m.when(callsTo("foo")).thenReturn("A"); |
| 714 m.when(callsTo("foo", "bar")).thenReturn("B"); | 714 m.when(callsTo("foo", "bar")).thenReturn("B"); |
| 715 expect(m.foo("bar", "mock"), "C"); | 715 expect(m.foo("bar", "mock"), "C"); |
| 716 expect(m.foo("bar", "mock"), "C"); | 716 expect(m.foo("bar", "mock"), "C"); |
| 717 expect(m.foo("bar", "mock"), "C"); | 717 expect(m.foo("bar", "mock"), "C"); |
| 718 expect(m.foo("bar", "mock"), "C"); | 718 expect(m.foo("bar", "mock"), "C"); |
| 719 m.resetBehavior(); | 719 m.resetBehavior(); |
| 720 }); | 720 }); |
| 721 |
| 722 solo_test('Spys', () { |
| 723 var real = new Foo(); |
| 724 var spy = new Mock.spy(real); |
| 725 var sum = spy.sum(1, 2, 3); |
| 726 expect(sum, 6); |
| 727 expect(() => spy.total(1, 2, 3), throwsNoSuchMethodError); |
| 728 spy.getLogs(callsTo('sum')).verify(happenedExactly(1)); |
| 729 spy.getLogs(callsTo('total')).verify(happenedExactly(1)); |
| 730 }); |
| 721 } | 731 } |
| 722 | 732 |
| OLD | NEW |