Skip to content

Instantly share code, notes, and snippets.

@analogrelay
Created December 19, 2011 22:15
Show Gist options
  • Save analogrelay/1499158 to your computer and use it in GitHub Desktop.
Save analogrelay/1499158 to your computer and use it in GitHub Desktop.
Mocking internal interfaces
// Product Code
internal interface IFoo
{
void Bar();
void Baz();
}
// Test Code
public abstract class MockableFoo : IFoo
{
public abstract void Bar();
public abstract void Baz();
}
...
[Fact]
public void TestBar() {
var mock = new Mock<MockableFoo>();
mock.Setup(m => m.Bar()).Returns(...);
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment