public async Task AddProperty_WithInvalidProperty_ShouldNotAddToShowPropertiesList(string propertyName = null) { // Arrange var actionSheetTitle = "Voeg nieuw veld toe"; var actionSheetCancelButton = "Annuleer"; PageDialogServiceMock.Setup(dialogService => dialogService.DisplayActionSheetAsync(actionSheetTitle, actionSheetCancelButton, null, HiddenPropertiesNl)).Returns(Task.Run(() => propertyName)); // Act EditRecipePageViewModel.Recipe = SelectedRecipe; await EditRecipePageViewModel.AddProperty(); // Assert PageDialogServiceMock.Verify(dialogService => dialogService.DisplayActionSheetAsync(actionSheetTitle, actionSheetCancelButton, null, HiddenPropertiesNl), Times.Once, "Action Sheet to select which property to add was not called."); Assert.IsEmpty(EditRecipePageViewModel.ShowProperties, "A property was added to attribute EditRecipePageViewModel.ShowProperties."); }
public async Task AddProperty_WhenPropertySelected_ShouldAddToShowPropertiesList(string propertyName) { // Arrange var actionSheetTitle = "Voeg nieuw veld toe"; var actionSheetCancelButton = "Annuleer"; var propertyNl = SelectedRecipe.EnToNlTranslation(propertyName); PageDialogServiceMock.Setup(dialogService => dialogService.DisplayActionSheetAsync(actionSheetTitle, actionSheetCancelButton, null, HiddenPropertiesNl)).Returns(Task.Run(() => propertyNl)); // Act EditRecipePageViewModel.Recipe = SelectedRecipe; await EditRecipePageViewModel.AddProperty(); // Assert PageDialogServiceMock.Verify(dialogService => dialogService.DisplayActionSheetAsync(actionSheetTitle, actionSheetCancelButton, null, HiddenPropertiesNl), Times.Once, "Action Sheet to select which property to add was not called."); Assert.Contains(propertyName, EditRecipePageViewModel.ShowProperties, $"Property {propertyName} not added to attribute EditRecipePageViewModel.ShowProperties."); }