title: Moq - Mock method returns null
body: <p>AddAsync method always returns null</p>
  <p>Code where I mocked the data:</p>
  <pre><code>var mockFileService = new Mock&lt;IFileService&gt;();
  
  var bytes = Encoding.UTF8.GetBytes(&quot;This is a dummy file&quot;);
  IFormFile file = new FormFile(new MemoryStream(bytes), 0, bytes.Length, &quot;Data&quot;, &quot;dummy.pdf&quot;);
  
  mockFileService.Setup(f =&gt; f.AddAsync(file, &quot;pathToFolder&quot;, &quot;nameFile&quot;)).ReturnsAsync(&quot;pathToFile&quot;);
  _fileService = mockFileService.Object;
        
  </code></pre>
  <p>Interface which I mock:</p>
  <pre><code>public interface IFileService
  {
      Task&lt;string&gt; AddAsync(IFormFile file, string pathToFolder, string nameFile);
      Task&lt;string&gt; AddAsync(byte[] file, string pathToFolder, string nameFile);
      Task AddImagesJpegAsync(Image[] images, string path, string imagesPrefix);
      Task&lt;byte[]&gt; GetAsync(string pathToFile);
      void DeleteFolder(string path);
      void CreateFolder(string path);
  }
          
  </code></pre>