title: Return data null when unit test the service using Moq
body: <p>I am having a problem when using the Moq for unit testing the a function which accepts number of parameters. I did the bellow steps to moq the service. </p>
  
  <ol>
  <li><p>Created a mock object to interface. the relevant method in the interface contains four arguments namely int type, a collection and a object. so i initailized the variable needed for those first,</p></li>
  <li><p>Then setup the mock object to return a a predefined type of object.</p></li>
  <li><p>After that the relevant method in the service class is called with the required arguments the method does not return the object that it is supposed to return (moq object) but it rather returns a null object.</p></li>
  </ol>
  
  <p>Am I missing anything in the code bellow? </p>
  
  <pre><code> Collection&lt;MyDocumentSample spec = new Collection&lt;MyDocumentSample()
   { 
    new MyIdSample() { SampleID = 1234 } };
    int index = 0;
    int maxNoOfRows = 2;
    MyDocumentListSortFields sortFeild = new
    MyDocumentListSortFields() 
    { 
         Descending = false, 
         SortField = MyDocumentListSortFields.SortFields.Date 
    };
  
  
  var bundleOfObjects = new bundleOfObjects { Entry = new List&lt;bundleOfObjects.EntryComponent() };
  
  MySampleDocument resource_1 = new MySampleDocument();
  resource_1.Id = "1005823";
  resource_1.Description = "Test 1";
  resource_1.Created = "11/20/2017 12:59:47 PM";
  
  
  bundleOfObjects.AddTobundleOfObjects(resource_1, null);
  var m_documentWrapperHelperMock = new Mock&lt;IDocumentSampleHelper();
  var m_configMock = new Mock&lt;IConfiguration();
  
  m_documentWrapperHelperMock.Setup(x =&gt; x.GetSampleDocumentsWithOffSets(spec, index, maxNoOfRows, sortFeild)).Returns(bundleOfObjects);
  
  
  var service = new MySampleDocumentService(m_configMock.Object, m_documentWrapperHelperMock.Object);
  </code></pre>