main
1using System;
2using Rhino.Mocks;
3
4namespace tests
5{
6 public class MethodCallOccurance<T>
7 {
8 readonly Action<T> action;
9 readonly T mock;
10
11 public MethodCallOccurance(T mock, Action<T> action)
12 {
13 this.action = action;
14 this.mock = mock;
15 mock.AssertWasCalled(action);
16 }
17
18 public void times(int number_of_times_the_method_should_have_been_called)
19 {
20 mock.AssertWasCalled(action, y => y.Repeat.Times(number_of_times_the_method_should_have_been_called));
21 }
22
23 public void only_once()
24 {
25 times(1);
26 }
27
28 public void twice()
29 {
30 times(2);
31 }
32 }
33}