title: How can I Mock async method holding CrossFilePicker?
body: <p>I am working on Xamarin.Forms project, that is using <code>Autofac</code>, <code>Moq</code>, and <code>Plugin.FilePicker</code>.</p>
  
  <p>One of button commands is calling method:</p>
  
  <pre><code>private async void OnLoadFileExecute(object obj)
  {
      await PickUpFile();
      LoadedPhrases = LoadFromFile(FileLocation);
      PopulateDb(LoadedPhrases);
      LoadGroups();
  }
  </code></pre>
  
  <p>And <code>PickUpFile()</code> method is <code>async</code>:</p>
  
  <pre><code>public async Task&lt;string&gt; PickUpFile()
  {
      try
      {
          FileLocation = "";
          var file = await CrossFilePicker.Current.PickFile();
          if (file != null)
          {
              FileLocation = file.FilePath;
              return FileLocation;
          }
          else
          {
              FileLocation = "";
              return "";
          }
      }
      catch (Exception ex)
      {
          Debug.WriteLine("Exception choosing file: " + ex.ToString());
          return "";
      }
  }
  </code></pre>
  
  <p>I wanted to test whole command, so all methods in <code>OnLoadFileExecute</code> will be tested. In that case I am not sure how can I Setup <code>PickUpFile()</code> method to return some <code>string</code>. As far as I know, I can not use in the <code>interface</code> async methods. Correct me if I am wrong. If I could, I would be able to mock it.</p>