/
SpecsFor.cs
40 lines (36 loc) · 1.31 KB
/
SpecsFor.cs
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
using Autofac;
using Autofac.Extras.Moq;
using SpecsFor.Core;
namespace SpecsFor.Autofac
{
public class SpecsFor<T> : SpecsForBase<T> where T : class
{
/// <summary>
/// Override this in your specs if you need to provide additional configuration, such as
/// supplying a concrete implmentation of an interface.
/// </summary>
/// <param name="mocker"></param>
public virtual void ConfigureMocker(AutoMock mocker)
{
}
/// <summary>
/// Override this in your specs if you want to use a different setting of Autofac's AutoMocker.
/// The default is AutoMock.GetLoose(). You can also use AutoMock.GetStrict(), or provide your own repository with
/// AutoMock.GetFromRepository(myRepository);
/// </summary>
/// <returns></returns>
public virtual AutoMock CreateInternalMocker()
{
return AutoMock.GetLoose();
}
/// <summary>
/// Do not override this unless you really know what you're doing. If you're trying to adjust Moq behavior,
/// override CreateMocker() instead.
/// </summary>
/// <returns></returns>
protected override IAutoMocker CreateAutoMocker()
{
return new AutofacAutoMocker<T>(this);
}
}
}