public async Task DisplayActionSheet_NullButtonAndOtherButtonPressed() { var service = new PageDialogServiceMock("other"); var buttonPressed = false; var command = new DelegateCommand(() => buttonPressed = true); var button = ActionSheetButton.CreateButton("other", command); await service.DisplayActionSheet(null, button, null); Assert.True(buttonPressed); }
public async Task DisplayActionSheet_CancelButtonPressed() { var service = new PageDialogServiceMock("cancel"); var cancelButtonPressed = false; var cancelCommand = new DelegateCommand(() => cancelButtonPressed = true); var button = ActionSheetButton.CreateCancelButton("cancel", cancelCommand); await service.DisplayActionSheet(null, button); Assert.True(cancelButtonPressed); }
public async Task DisplayActionSheet_NoButtonPressed() { var service = new PageDialogServiceMock(null); var buttonPressed = false; var cancelCommand = new DelegateCommand(() => buttonPressed = true); var button = ActionSheetButton.CreateCancelButton("cancel", cancelCommand); var destroyCommand = new DelegateCommand(() => buttonPressed = true); var destroyButton = ActionSheetButton.CreateDestroyButton("destroy", destroyCommand); await service.DisplayActionSheet(null, button, destroyButton); Assert.False(buttonPressed); }
public async Task DisplayActionSheetNoButtons_ShouldThrowException() { var service = new PageDialogServiceMock("cancel"); var argumentException = await Assert.ThrowsAsync <ArgumentException>(() => service.DisplayActionSheet(null, null)); Assert.Equal(typeof(ArgumentException), argumentException.GetType()); }