title: Testing Xamarin Navigation methods with context Binding on destination page fails
body: <p>I have a problem with Xamarin framework. I am trying to test a Navigation.PushAsync method and I get an error:</p>
  
  <p>"You must call Xamarin.Forms Init() prior using it"</p>
  
  <p><strong>Scenario</strong></p>
  
  <p>Just imagine a simple content page in Xamarin which looks like this in the code behind.</p>
  
  <pre><code>public partial class TesterPage : ContentPage
  {
  
  
      public TesterPage()
      {
        InitializeComponent();
      }
  }
  </code></pre>
  
  <p>And here is the XAML part for it:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;ContentPage 
  
           xmlns="http://xamarin.com/schemas/2014/forms"
           xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
           x:Class="BoatInspectorPMS.TesterPage"&gt;
  &lt;ContentPage.Content&gt;
      &lt;StackLayout&gt;
          &lt;Label Text="Welcome to Xamarin Forms!" /&gt;
      &lt;/StackLayout&gt;
  &lt;/ContentPage.Content&gt;
  &lt;/ContentPage&gt;
  </code></pre>
  
  <p>This is out destination page. We have the origin page that looks like this partly.</p>
  
  <pre><code>public class MainViewModel
  {
       private readonly IPageService _pageService;
  
       public MainViewModel(IPageService pageService)
       {
          _pageService = pageService;
       }
  
       public async Task NewSurvey()
       {
          await _pageService.PushAsync(new TesterPage());
       }
  }
  </code></pre>
  
  <p>The interface IPageService looks like this:</p>
  
  <pre><code>public interface IPageService
  {
      Task PushAsync(Page page);
  }
  </code></pre>
  
  <p>So we want to run a test which looks like this. Here is our test.</p>
  
  <pre><code>    [Test]
      public async Task OurTest()
      {           
          //mock PageService
          var pageService = new Mock&lt;PageService&gt;();
          var mvm = new MainViewModel(pageService.Object);
  
          await mvm.NewSurvey();
          pageService.Verify(p =&gt; p.PushAsync(It.IsAny&lt;TesterPage&gt;()));
  
      }
  </code></pre>
  
  <p>I get an error in the constructor of TesterPage at InitializeComponent() at the moment when it enters auto generated code</p>
  
  <pre><code>  private void InitializeComponent() {
          global::Xamarin.Forms.Xaml.Extensions.LoadFromXaml(this, typeof(TesterPage));
      }
  </code></pre>
  
  <p>Pretty stuck on this issue. Hope someone has come across a similar situation. Thank you.</p>