forked from darrencauthon/AutoMoq
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadme.txt
More file actions
27 lines (14 loc) · 874 Bytes
/
readme.txt
File metadata and controls
27 lines (14 loc) · 874 Bytes
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
AutoMoqer is an "auto-mocking" container that automatically creates any fake objects that are necessary to instantiate the class under test. You can access those fakes through the mocker, or you can just ignore them if they're not important.
I wrote it for a few reason:
1.) I was tired of having of my tests breaking the build whenever I added or removed a dependency to a class.
2.) I was tired of managing instances of fakes in my unit tests, especially when they weren't relevant to test I was running.
Example code:
var mocker = new AutoMoqer();
mocker.GetMock<IDataDependency>()
.Setup(x => x.GetData())
.Returns("TEST DATA");
var classToTest = mocker.Resolve<ClassToTest>();
classToTest.DoSomething();
mocker.GetMock<IDependencyToCheck>()
.Setup(x=>x.CallMe("TEST"), Times.Once());
CallMe("TEST"), Times.Once());