public void RaiseAsync() { var navigationRequest = new NavigationRequest(); var actionMock = new Mock <INavigationAction>(); navigationRequest.NavigationAction = actionMock.Object; navigationRequest.RaiseAsync(); actionMock.Verify(m => m.Navigate <object>(null), Times.Once); }
public void RaiseAsync_WithParameter() { var navigationRequest = new NavigationRequest <string>(); var actionMock = new Mock <INavigationAction>(); navigationRequest.NavigationAction = actionMock.Object; var parameter = "Hello, Parameter!"; navigationRequest.RaiseAsync(parameter); actionMock.Verify(m => m.Navigate(parameter), Times.Once); }
public void Navigate() { var navigationRequest = new NavigationRequest(); var navigationActionMock = new NavigationBehaviorMock <ContentPage> { Request = navigationRequest }; navigationRequest.RaiseAsync(); Assert.Equal(navigationRequest, navigationActionMock.Request); Assert.True(navigationActionMock.Navigated); Assert.Equal(typeof(object), navigationActionMock.ParameterType); Assert.Null(navigationActionMock.Parameter); }
public async void NavigationRequestPropertyChanged_ToNull() { var navigationRequest = new NavigationRequest(); var navigationActionMock = new NavigationBehaviorMock <ContentPage> { Request = navigationRequest }; navigationActionMock.Request = null; Assert.Null(navigationActionMock.Request); await Assert.ThrowsAsync <InvalidOperationException>(() => navigationRequest.RaiseAsync()); Assert.False(navigationActionMock.Navigated); Assert.Null(navigationActionMock.ParameterType); Assert.Null(navigationActionMock.Parameter); }
public void Navigate_WithParameter() { var navigationRequest = new NavigationRequest <string>(); var navigationActionMock = new NavigationBehaviorMock <ContentPage> { Request = navigationRequest }; var parameter = "Hello, Parameter!"; navigationRequest.RaiseAsync(parameter); Assert.Equal(navigationRequest, navigationActionMock.Request); Assert.True(navigationActionMock.Navigated); Assert.Equal(typeof(string), navigationActionMock.ParameterType); Assert.Equal(parameter, navigationActionMock.Parameter); }
public async void RaiseAsync_WithParameter_WhenNavigationActionIsNull() { var navigationRequest = new NavigationRequest <string>(); await Assert.ThrowsAsync <InvalidOperationException>(() => navigationRequest.RaiseAsync("Hello, Parameter!")); }
public async void RaiseAsync_WhenNavigationActionIsNull() { var navigationRequest = new NavigationRequest(); await Assert.ThrowsAsync <InvalidOperationException>(() => navigationRequest.RaiseAsync()); }