title: unit test rabbitMQ c# Moq
body: <p>I´m trying to unit test my RabbitMQ exchanges and queues, using the Moq nuget package. but no matter how I try and how much I use google, I cannot understand how I am supposed to mock rabbitMQ objects. 
  any pointers to someone very new to unit test, mockups??? </p>
  
  <p>I have tried using the nuget package RabbitMQ.Fakes like so: </p>
  
  <pre class="lang-cs prettyprint-override"><code>[TestMethod]
  public void testconnectionnotnull()
  {
      FakeConnectionFactory factory = new FakeConnectionFactory();
      IConnection connection = factory.CreateConnection();
  
      NUnit.Framework.Assert.That(connection.IsOpen);
      NUnit.Framework.Assert.That(factory.Connection, 
      NUnit.Framework.Assert.AreSame(connection));
  }
  </code></pre>
  
  <p>but when I create the <code>IConnection</code>, I get following error: </p>
  
  <blockquote>
    <p>System.TypeLoadException: 'Method 'CreateBasicPublishBatch' of type 'RabbitMQ.Fakes.FakeModel' from assembly 'RabbitMQ.Fakes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not implemented.'</p>
  </blockquote>
  
  <p>I´ve also tried just to instantiate a standard mock object, but I cannot find the right way to do so and be able to use it. </p>
  
  <pre class="lang-cs prettyprint-override"><code>[TestMethod]
  public void TestFactoryNotNull()
  {
      Mock&lt;Rabbit_Recieve&gt; mock = new Mock&lt;Rabbit_Recieve&gt;(); 
  }
  </code></pre>