File tree Expand file tree Collapse file tree
src/Controls/tests/Core.UnitTests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using System ;
12using System . Collections . Generic ;
23using System . Linq ;
34using System . Threading . Tasks ;
@@ -99,17 +100,28 @@ public void Constructor()
99100 }
100101
101102 [ Fact ]
102- public async Task PushesIntoNextInner ( )
103+ public async Task PushesWithoutInner ( )
103104 {
104105 var page = new ContentPage ( ) ;
105106 var navProxy = new NavigationProxy ( ) ;
106107
107- await navProxy . PushAsync ( page ) ;
108+ Assert . ThrowsAsync < InvalidOperationException > ( async ( ) => await navProxy . PushAsync ( page ) ) ;
109+ }
108110
109- var navTest = new NavigationTest ( ) ;
110- navProxy . Inner = navTest ;
111+ [ Fact ]
112+ public async Task PushesIntoNextInner ( )
113+ {
114+ var proxy = new NavigationProxy ( ) ;
115+ var inner = new NavigationTest ( ) ;
116+ var page1 = new ContentPage ( ) ;
117+ var page2 = new ContentPage ( ) ;
118+
119+ proxy . Inner = inner ;
120+
121+ await proxy . PushAsync ( page1 ) ;
122+ await proxy . PushAsync ( page2 ) ;
111123
112- Assert . Equal ( page , navTest . LastPushed ) ;
124+ Assert . Equal ( page2 , inner . LastPushed ) ;
113125 }
114126
115127 [ Fact ]
Original file line number Diff line number Diff line change @@ -839,6 +839,15 @@ public async Task PopModalWithEmptyStackThrows()
839839 Assert . ThrowsAsync < InvalidOperationException > ( ( ) => window . Navigation . PopModalAsync ( ) ) ;
840840 }
841841
842+ [ Fact ]
843+ public async Task PushWithoutWrappingIntoNavigationPage ( )
844+ {
845+ var window = new TestWindow ( new ContentPage ( ) ) ;
846+ var contentPage1 = new ContentPage ( ) ;
847+ var navigationPage = new TestNavigationPage ( true , contentPage1 ) ;
848+ Assert . ThrowsAsync < InvalidOperationException > ( ( ) => window . Navigation . PushAsync ( contentPage1 ) ) ;
849+ }
850+
842851 [ Fact ]
843852 public async Task TabBarSetsOnFlyoutPageInsideModalPage ( )
844853 {
You can’t perform that action at this time.
0 commit comments