Skip to content

Instantly share code, notes, and snippets.

@Flayed
Created March 11, 2018 17:52
Show Gist options
  • Select an option

  • Save Flayed/a7bf14631c1c794dbe31397eac2ca6bd to your computer and use it in GitHub Desktop.

Select an option

Save Flayed/a7bf14631c1c794dbe31397eac2ca6bd to your computer and use it in GitHub Desktop.
TestBase
public class TestBase : IDisposable
{
public readonly AutoMock Mock;
public TestBase()
{
Mock = AutoMock.GetLoose();
}
public TImplementation Provide<TInterface, TImplementation>()
where TInterface : class
where TImplementation : TInterface
{
TImplementation impl = Mock.Create<TImplementation>();
Mock.Provide<TInterface>(impl);
return impl;
}
public void Dispose()
{
Mock.Dispose();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment