public void TestRefreshCommandSucceeded() { var myUvpToReturn = new MyUvp { Me = new Student { StudentId = "stuid" } }; var rootFrameNavigated = false; var stubRootNavigationService = new StubIRootNavigationService(); stubRootNavigationService.Navigate( (sourcePageType, parameter, navigationTransition) => rootFrameNavigated = true); var dialogShown = false; var stubDialogService = new StubIDialogService(); stubDialogService.ShowAsync(async message => dialogShown = true); var getRequested = false; var myUvpService = new StubIMyUvpService(); myUvpService.GetAsync(async() => { getRequested = true; return(new ServiceResult <MyUvp> { Status = ServiceResultStatus.OK, Result = myUvpToReturn }); }); var stubITileService = new StubITileService(); var studentIdSet = ""; stubITileService.SetUpdate(studentId => studentIdSet = studentId); var myUvpViewModel = new MyUvpViewModel(myUvpService, stubDialogService, stubRootNavigationService, null, stubITileService); myUvpViewModel.RefreshCommand.Execute(null); Assert.IsFalse(rootFrameNavigated); Assert.IsFalse(dialogShown); Assert.IsTrue(getRequested); Assert.AreSame(myUvpToReturn, myUvpViewModel.MyUvp); Assert.AreEqual(myUvpToReturn.Me.StudentId, studentIdSet); }
public void TestRefreshCommandSucceeded() { var myUvpToReturn = new MyUvp(); var rootFrameNavigated = false; var stubRootNavigationService = new StubIRootNavigationService(); stubRootNavigationService.Navigate( (sourcePageType, parameter, navigationTransition) => rootFrameNavigated = true); var dialogShown = false; var stubDialogService = new StubIDialogService(); stubDialogService.ShowAsync(async message => dialogShown = true); var checkRequested = false; var myUvpService = new StubIMyUvpService(); myUvpService.GetAsync(async() => { checkRequested = true; return(new ServiceResult <MyUvp> { Status = ServiceResultStatus.OK, Result = myUvpToReturn }); }); var myUvpViewModel = new MyUvpViewModel(myUvpService, stubDialogService, stubRootNavigationService, null); myUvpViewModel.RefreshCommand.Execute(null); Assert.IsFalse(rootFrameNavigated); Assert.IsFalse(dialogShown); Assert.IsTrue(checkRequested); Assert.AreSame(myUvpToReturn, myUvpViewModel.MyUvp); }