title: Test a method with a dependency on a base property
body: <p>I have a QuickController class that inherits from a BaseController. A method in QuickController calls a property on the BaseController which have a dependency on ConfigurationManager.AppSettings.</p>
  
  <p>I want to unit test QuickController but can't find a way to get rid of that dependency. Here's my test:</p>
  
  <pre><code>[TestMethod]
  public void TestMethod1()
  {
      var moqServiceWrapper = new Mock&lt;IServiceWrapper&gt;();
  
      var controller = new QuickController(moqServiceWrapper.Object);
  
      //Act
      var result = controller.Estimator(QuickEstimatorViewModel);
  
      //Assert
      Assert.IsInstanceOfType(result, typeof(ViewResult));
  }
  </code></pre>
  
  <p>The QuickController class</p>
  
  <pre><code>public class QuickController : BaseController
  {
      public QuickController(IServiceWrapper service)
          : base(service) { }
  
      public ActionResult Estimator(QuickEstimatorViewModel viewModel)
      {
          viewModel.RiskAddressLocation = RiskAddressLocation;
  
          ....
  
          return View("QuickQuote", viewModel);
      }
  }
  </code></pre>
  
  <p>And the BaseController property</p>
  
  <pre><code>public RiskAddressLocation RiskAddressLocation
  {
      get { return ConfigurationManager.AppSettings["..."]
                              .ToEnum&lt;RiskAddressLocation&gt;(true); }
  }
  </code></pre>
  
  <p>I also tried to call the method on a FakeQuickController that inherit from QuickController, but can't override the property, it's the one in the BaseController that is always called.</p>
  
  <p>Is there anything I can do here?</p>
  
  <p><strong>Update</strong></p>
  
  <p>From the accepted answer here's what I had that VS2013 didn't like</p>
  
  <pre><code>public class BaseController{
      public virtual RiskAddressLocation RiskAddressLocation {get{...;}
  }
  
  public class QuickController : BaseController{}
  
  public class FakeQuickController : QuickController{
      public override RiskAddressLocation RiskAddressLocation
      { 
          get { return ...} // Doesn't compile (cannot override because
                   //BaseController.RiskAddressLocation' is not a function
      }
  }
  </code></pre>
  
  <p>This however, works fine</p>
  
  <pre><code>public class BaseController{
      public virtual RiskAddressLocation RiskAddressLocation(){...}
  }
  
  public class QuickController : BaseController{}
  
  public class FakeQuickController : QuickController{
      public override RiskAddressLocation RiskAddressLocation()
      { 
          return ... ;
      }
  }
  </code></pre>