title: Why does FakeItEasy throw this exception, and why does making the method virtual fix it?
body: <p>I have a test (code is below) to test that Method1 calls Method2. The exception I'm getting is</p>
  
  <blockquote>
    <p>The current proxy generator can not intercept the specified method for
    the following reason: - Sealed methods can not be intercepted.</p>
  </blockquote>
  
  <p>The method under test isn't sealed itself. However, it does have a <em>dependency</em> on a sealed class (a third-party class for which I am having trouble creating a wrapper in order to mock it properly - another topic for another question). Either way, <em>at this point</em> I'm not asking FakeItEasy to mock the sealed class. And while debugging my test, when the dependency is called, I can clearly see that a real object is being produced, not a fake. </p>
  
  <p>And yet, given the error message, I feel like it might be related somehow. 
  <br /><br /></p>
  
  <p>Further, I discovered through a <a href="http://geekswithblogs.net/Aligned/archive/2013/03/12/fakeiteasy---sealed-methods-can-not-be-intercepted-exception.aspx" rel="noreferrer" title="random blog post">random blog post</a> that making the method virtual fixes the problem, allowing the test to pass. I gave it a try and it worked. But I don't get <em>why</em> it fixed it, and regardless, it doesn't make sense for me to keep the method virtual. In my case, the class being tested doesn't have any children of its own, ie; no children to override its methods, so I can't see any reason to make it virtual. </p>
  
  <p>Am I wrong in thinking I have no reason to make the method virtual?<br /> 
  Is FakeItEasy somehow trying to mock that sealed class?</p>
  
  <p>I'm really not sure how to proceed with this test.<br /><br /></p>
  
  <p><strong>My Test</strong></p>
  
  <pre><code>[SetUp]
  public void SetUp()
  {
      // Arrange
      _service2 = A.Fake&lt;Service2&gt;(x =&gt; x.WithArgumentsForConstructor(
                                          () =&gt; new Service2()));
      _service1 = A.Fake&lt;Service1&gt;(x =&gt; x.WithArgumentsForConstructor(
                                          () =&gt; new Service1(_service2)));
  }
  
  [Test]
  public void when_Method1_executes_it_calls_Method2()
  {
      // Act
      result = _service1.Method1();
  
      // Assert
       A.CallTo(() =&gt; _service2.Method2())
                                     .WithAnyArguments()
                                     .MustHaveHappened();
  }
  </code></pre>
  
  <p><br />
  <strong>Related Methods</strong></p>
  
  <pre><code>public class Service1 : IService1
  {
      private readonly IService2 _service2;
      public Service1(IService2 service2)
      { 
          _service2 = service2; 
      }
  
      public bool Method1()
      {
          using (var dependency = new MyDependency()) // third party sealed class
          {
          }
  
          var x = _service2.Method2();            
      }
  }   
  
  
  public class Service2 : IService2
  {
      public bool Method2() // making this virtual fixes the FakeItEasy exception
      {            
      }
  }
  </code></pre>