/// <summary> /// Initializes a new <see cref="MainPage" />. /// </summary> /// <param name="runner">The NUnit test runner to associate with this master and detail pages.</param> /// <param name="initializeComponent">If the <see cref="InitializeComponent" /> should be called.</param> internal MainPage(INUnitRunner runner, bool initializeComponent) { v_InitializeComponent = initializeComponent; // Under normal operation the InitializeComponent should always be called // But for unit testing InitializeComponent should not be called as it invokes the Xamarin.Forms context. if (initializeComponent) { InitializeComponent(); // Set tab feed icon on iOS if (string.Equals(Device.RuntimePlatform, Device.iOS, StringComparison.Ordinal)) { IconImageSource = ImageSource.FromResource(Resource.TabFeedImagePath, GetType().Assembly); } MasterBehavior = MasterBehavior.Popover; } v_TestRunner = runner; Detail = new NavigationPage(new TestsPage(runner, null, initializeComponent)); Master = new MenuPage(this, initializeComponent); // Set Detail (current test page) in menu navigation cache v_MenuPages.Add(MenuItemType.Tests, (NavigationPage)Detail); }
/// <summary> /// Initializes a new <see cref="TestsPage" />. /// </summary> /// <param name="runner">The NUnit test runner to associate with this master and detail pages.</param> /// <param name="test">The NUnit test to associate with this item page.</param> /// <param name="initializeComponent">If the <see cref="InitializeComponent" /> should be called.</param> internal TestsPage(INUnitRunner runner, TestsViewModel test, bool initializeComponent) { v_InitializeComponent = initializeComponent; v_TestRunner = runner; // Set view model to default (top-level) if test is null or as a sub-top test ViewModel = test ?? new TestsViewModel(runner); if (initializeComponent) { InitializeComponent(); BindingContext = ViewModel; } }
/// <summary> /// Initializes a new <see cref="TestsPage" />. /// </summary> /// <param name="runner">The NUnit test runner to associate with this master and detail pages.</param> /// <param name="test">The NUnit test to associate with this item page.</param> public TestsPage(INUnitRunner runner, TestsViewModel test = null) : this(runner, test, true) { }
/// <inheritdoc /> public TestsPageForTest(INUnitRunner runner, TestsViewModel test = null) : base(runner, test, false) { }
/// <inheritdoc /> public MainPageForTest(INUnitRunner runner) : base(runner, false) { }
/// <summary> /// Initializes a new <see cref="App" /> instance. /// </summary> /// <param name="runner">The <see cref="INUnitRunner" /> to load and run test from.</param> public App(INUnitRunner runner) { InitializeComponent(); MainPage = new MainPage(runner); }
/// <summary> /// Initializes a new <see cref="MainPage" />. /// </summary> /// <param name="runner">The NUnit test runner to associate with this master and detail pages.</param> public MainPage(INUnitRunner runner) : this(runner, true) { }