public DisplayAlert ( string title, string message, string cancel ) : System.Threading.Tasks.Task | ||
title | string | |
message | string | |
cancel | string | |
리턴 | System.Threading.Tasks.Task |
public void DisplaysAlert() { var page = new Mock<IPage>(); var dialogService = new DialogService(page.Object); dialogService.DisplayAlert("Alert", "You have been alerted", "OK"); page.Verify(x => x.DisplayAlert("Alert", "You have been alerted", "OK")); }
public async void DisplaysAlertWithResponse() { var page = new Mock<IPage>(); page.Setup(x => x.DisplayAlert(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())) .ReturnsAsync(true); var dialogService = new DialogService(page.Object); var answer = await dialogService.DisplayAlert("Question?", "Would you like to play a game", "Yes", "No"); page.Verify(x => x.DisplayAlert("Question?", "Would you like to play a game", "Yes", "No")); Assert.That(answer, Is.True); }