Skip to content

grollinger/AutoMoq

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoMoqer is an "auto-mocking" container that automatically creates any fake objects that are necessary to instantiate the class under test. It's very similar to an IoC container in that it has a generic Resolve method that automatically fills in all dependencies, but unlike an IoC container it resolves the dependencies with mock objects.  This can make your testing cleaner by allowing you to only write code for the mock objects that are relevant to your specific test.

This tool uses Moq, my favorite .Net mocking framework, for all mocks.


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());
   

About

Auto mocking provider for Moq.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 92.1%
  • Ruby 6.2%
  • Classic ASP 1.5%
  • Shell 0.2%