title: Cannot create a Mock class for an internal type using Rhino Mocks
body: <p>I am using Rhino Mocks as a mocking framework for unit testing.</p>
  
  <p>I have a class called Subject which is the class I want to test. It has a dependency on IStore.</p>
  
  <p>IStore is defined as follows:</p>
  
  <pre><code>//internal interface : has InternalsVisible to both "Subject" 
  //and "StoreTests" class namespaces
  internal interface IStore {
      void Store(string name);
      //other methods
  }
  </code></pre>
  
  <p>and the Subject class is defined as follows:</p>
  
  <pre><code>class Subject : IStore {
      private IStore internalStore;
  
      //constructor injection
      void Subject(IStore store) {
          internalStore = store;
      }
  
      void Store(string name) {
          internalStore.Store(name);
      }
  
      //other methods
  }
  </code></pre>
  
  <p>My test class using RhinoMocks is as follows:</p>
  
  <pre><code>//test class
  class StoreTests {
      Subject subject = new Subject();
  
      [Test]
      public StoreTest() {
          //Arrange
          var mockStore = MockRepository.GenerateMock&lt;IStore&gt;();
          string testName = "test";
          mockStore.Expect(x =&gt; x.Store(testName)).Returns(null);
  
          //Act
          subject.Store(testName);
  
          //Assert
          mockStore.VerifyAllExpectations();
      }
  
      //other test methods
  }
  </code></pre>
  
  <p>In my setup, the interface is defined as internal and it has InternalsVisible set for both Subject class and StoreTests class. However, when the test case executes, it throws an exception at var mockStore = MockRepository.GenerateMock();
  saying that IStore is not public and therefore it could not generate a Mock. </p>
  
  <p>I think this is because the IStore is not public. However, since I have set InternalsVisibleTo on the IStore dll, will it not be sufficent for StoreTests to create a mock for that class?</p>
  
  <p>Now I think this problem may be solved by making the IStore interface public. However given that this is not an option for me, is there any other way I can create a mock for IStore ?</p>