title: How to create Mock for the abstract base class using MOQ framework?
body: <p>I want to write unit tests for MyClass but its base class is an abstract class.</p>
  
  <pre><code>public class MyClass : AbstractBaseClass
  {
  }
  </code></pre>
  
  <p>I want to Mock the AbstractBase class, so that I can skip some of the logic in its constructor when I create the MyClass instance I want to test.  Is there anyway I can do this?</p>
  
  <pre><code>//Unit Test
  var test = new Mock&lt;IInterface&gt;();
  var derivedclass = new DerivedClass(test.Object);
  
  test.Setup(d=&gt;d.MyMethod(It.IsAny&lt;string&gt;()).returns(2);
  derivedclass.MyMethod("hello");
  
  
  // Derived Class
  class DerivedClass : AbstractClass{
  
       //constuctor
      public DerivedClass(IInterface interface){
          _interface = interface;
      }
      public MyMethod(string str){
          return 2;
      }
  }
  
  //Abstract Class
  public abstract class AbstractClass
  {
  
   // This method gets called when i create the  instance of the derived class in my unit   
    test..
  
     protected AbstractedClass() : this(new SomeOtherClass()){
         DoSomethingElse();    /// I want to skip this method or mock it.
     }
   }
  </code></pre>