public async Task DeleteUser_ConfirmationIsCanceled_UserIsNitDeleted()
        {
            // Arrange
            var user = MakeUser();

            _userRepository.GetAll().Returns(new List <User> {
                user
            });
            await sut.Load();

            var userToDelete = sut.Users.First();

            _messageDialog
            .Show(
                title: General.DeleteUserTitle,
                message: string.Format(General.DeleteUserQuestion, userToDelete.Fullname),
                buttons: MessageBoxButtons.YesNo,
                icon: MessageBoxIcon.Warning)
            .Returns(DialogResult.No);

            // Act
            await sut.DeleteUserCommand.Execute(userToDelete);

            // Assert
            await _userRepository.DidNotReceive().Remove(user.Id);

            sut.Users.Should().HaveCount(1);
            _snackbarMessage.DidNotReceive().Show(
                message: string.Format(General.UserDeletedMessage, userToDelete.Fullname));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Shows a message dialog of the given <paramref name="dialogType"/>
        /// with the given arguments.
        /// </summary>
        /// <param name="dialogType">Type of the dialog</param>
        /// <param name="title">Dialog title</param>
        /// <param name="header">Dialog header</param>
        /// <param name="text">Dialog text</param>
        /// <param name="resultSet">Set of possible dialog results</param>
        /// <returns>Selected dialog result</returns>
        public static EMessageDialogResult Show(EMessageDialogType dialogType, string title, string header, string text,
                                                EMessageDialogResult[] resultSet)
        {
            IMessageDialog msgDlg = UIFactory.NewShell <IMessageDialog>();

            msgDlg.DialogType      = dialogType;
            msgDlg.WindowTitle     = title;
            msgDlg.Header          = header;
            msgDlg.Text            = text;
            msgDlg.DialogResultSet = resultSet ?? new[] { EMessageDialogResult.Ok };

            return(msgDlg.Show());
        }
Exemplo n.º 3
0
        public void ChangeCurrentCulture(LanguageDto selected)
        {
            var selectedLanguage = this.AvailableLanguages.FirstOrDefault(x => x.Culture.Equals(selected.Culture));

            if (selectedLanguage.Current)
            {
                return;
            }

            this.AvailableLanguages.ForAll(x => x.Current = false);
            selectedLanguage.Current = true;

            _settingProvider.SetCurrentCulture(selectedLanguage.Culture);

            _messageDialog.Show(
                title: General.LanguageChangeTitle,
                message: General.LanguageChangeMessage);
        }