forked from SharpRepository/SharpRepository
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestBase.cs
More file actions
45 lines (41 loc) · 1.49 KB
/
TestBase.cs
File metadata and controls
45 lines (41 loc) · 1.49 KB
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
37
38
39
40
41
42
43
44
45
using Rhino.Mocks;
namespace SharpRepository.Tests
{
public abstract class TestBase
{
protected static T N<T>() where T : class
{
return default(T);
}
/// <summary>
/// Create a mock
/// </summary>
/// <typeparam name="T">Type to be mocked</typeparam>
/// <param name="argumentsForConstructor">Constructor arguments</param>
/// <returns>T</returns>
protected static T M<T>(params object[] argumentsForConstructor) where T : class
{
return MockRepository.GenerateMock<T>(argumentsForConstructor);
}
/// <summary>
/// Create a partial mock
/// </summary>
/// <typeparam name="T">Type to be partially mocked</typeparam>
/// <param name="argumentsForConstructor">Constructor arguments</param>
/// <returns>T</returns>
protected static T Pm<T>(params object[] argumentsForConstructor) where T : class
{
return MockRepository.GeneratePartialMock<T>(argumentsForConstructor);
}
/// <summary>
/// Create a stub
/// </summary>
/// <typeparam name="T">Type to be stubbed</typeparam>
/// <param name="argumentsForConstructor">Constructor arguments</param>
/// <returns>T</returns>
protected static T S<T>(params object[] argumentsForConstructor) where T : class
{
return MockRepository.GenerateStub<T>(argumentsForConstructor);
}
}
}