Skip to content

Commit

Permalink
[testing] Enable shell tests back on net9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarinho committed Jul 11, 2024
1 parent facb5ef commit d32718c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 44 deletions.
58 changes: 29 additions & 29 deletions src/Controls/tests/Core.UnitTests/ShellLifeCycleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,35 +164,35 @@ public async Task EnsureOnAppearingFiresForLastPageOnly()
Assert.True(page.Appearing);
}

// [Fact]
// public async Task EnsureOnAppearingFiresForLastPageOnlyAbsoluteRoute()
// {
// Shell shell = new TestShell();
// LifeCyclePage shellContentPage = new LifeCyclePage();
// shell.Items.Add(CreateShellItem());
// shell.Items.Add(CreateShellItem(page: shellContentPage, shellItemRoute: "ShellItemRoute"));
// await shell.GoToAsync("///ShellItemRoute/LifeCyclePage/LifeCyclePage");

// var page = (LifeCyclePage)shell.GetVisiblePage();
// var nonVisiblePage = (LifeCyclePage)shell.Navigation.NavigationStack[1];

// Assert.False(shellContentPage.Appearing);
// Assert.False(nonVisiblePage.Appearing);
// await page.AppearingTask.ConfigureAwait(false);
// Assert.True(page.Appearing);
// }


// [Fact]
// public async Task EnsureOnAppearingFiresForPushedPage()
// {
// Shell shell = new TestShell();
// shell.Items.Add(CreateShellItem());
// await shell.Navigation.PushAsync(new LifeCyclePage());
// var page = (LifeCyclePage)shell.GetVisiblePage();
// Assert.True(page.Appearing);
// Assert.True(page.ParentSet);
// }
[Fact]
public async Task EnsureOnAppearingFiresForLastPageOnlyAbsoluteRoute()
{
Shell shell = new TestShell();
LifeCyclePage shellContentPage = new LifeCyclePage();
shell.Items.Add(CreateShellItem());
shell.Items.Add(CreateShellItem(page: shellContentPage, shellItemRoute: "ShellItemRoute"));
await shell.GoToAsync("///ShellItemRoute/LifeCyclePage/LifeCyclePage");

var page = (LifeCyclePage)shell.GetVisiblePage();
var nonVisiblePage = (LifeCyclePage)shell.Navigation.NavigationStack[1];

Assert.False(shellContentPage.Appearing);
Assert.False(nonVisiblePage.Appearing);
await page.AppearingTask.ConfigureAwait(false);
Assert.True(page.Appearing);
}


[Fact]
public async Task EnsureOnAppearingFiresForPushedPage()
{
Shell shell = new TestShell();
shell.Items.Add(CreateShellItem());
await shell.Navigation.PushAsync(new LifeCyclePage());
var page = (LifeCyclePage)shell.GetVisiblePage();
Assert.True(page.Appearing);
Assert.True(page.ParentSet);
}

[Fact]
public async Task NavigatedFiresAfterContentIsCreatedWhenUsingTemplate()
Expand Down
30 changes: 15 additions & 15 deletions src/Controls/tests/Core.UnitTests/ShellNavigatedArgsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,23 @@ await shell.TestNavigationArgs(ShellNavigationSource.Insert,
}


// [Fact]
// public async Task InsertPageFromNavigationSetsCorrectNavigationSource()
// {
// Routing.RegisterRoute("pagemiddle", typeof(ContentPage));
// Routing.RegisterRoute("page", typeof(ContentPage));
// var shell = new TestShell(
// CreateShellItem(shellItemRoute: "item")
// );
[Fact]
public async Task InsertPageFromNavigationSetsCorrectNavigationSource()
{
Routing.RegisterRoute("pagemiddle", typeof(ContentPage));
Routing.RegisterRoute("page", typeof(ContentPage));
var shell = new TestShell(
CreateShellItem(shellItemRoute: "item")
);

// await shell.GoToAsync("//item/page");
// ContentPage contentPage = new ContentPage();
// Routing.SetRoute(contentPage, "pagemiddle");
// shell.Navigation.InsertPageBefore(contentPage, shell.Navigation.NavigationStack.Last());
await shell.GoToAsync("//item/page");
ContentPage contentPage = new ContentPage();
Routing.SetRoute(contentPage, "pagemiddle");
shell.Navigation.InsertPageBefore(contentPage, shell.Navigation.NavigationStack.Last());

// await shell.TestNavigationArgs(ShellNavigationSource.Insert,
// "//item/page", "//item/pagemiddle/page");
// }
await shell.TestNavigationArgs(ShellNavigationSource.Insert,
"//item/page", "//item/pagemiddle/page");
}


[Fact]
Expand Down

0 comments on commit d32718c

Please sign in to comment.