Moq – Mocking a cast on an interface

moq logo

Mocking a Cast on a Mocked Interface

The Setup

var mockedInterface = new Mock<IInterface>();
mockedInterface.As().Setup(i => i.MethodOnTheInterface());

Easy as that!

Been working with Moq a fair bit recently. Some other Moq tips and tricks here.

Leave a Reply

%d bloggers like this: