If I have a class that has a dependency that is resolved via property injection, is it possible to Mock the behavior of that property using Moq?
e.g.
public class SomeClass
{
//empty constructor
public SomeClass() {}
//dependency
public IUsefuleService Service {get;set;}
public bool IsThisPossible(Object someObject)
{
//do some stuff
//I want to mock Service and the result of GetSomethingGood
var result = Service.GetSomethingGood(someObject);
}
}
So, SomeClass is under test and I am trying to figure out if I can mock the behavior of IUsefulService with Moq so when I test IsThisPossible and the line using the service is hit, the mock is used...