예제 #1
0
        public void NavigateToUsersView_AlreadyOpened_ShowErrorMessage()
        {
            // Arrange
            sut.NavigateToUsersView();
            _viewNavigator.ClearReceivedCalls();

            // Act
            sut.NavigateToUsersView();

            // Assert
            _viewNavigator.DidNotReceive().Open <UsersViewModel>();
            _messageDialog.Received().ShowError(
                title: General.AttentionTitle,
                message: General.CannotOpenWindowsTwice);
        }
예제 #2
0
        public async Task CreateUserCommand_InvalidForm_ShowErrorMessage()
        {
            // Arrange
            _roleRepository.GetAll().Returns(new List <Role> {
                Role.Basic, Role.Admin
            });
            await sut.Load();

            FillUserInfo(email: "invalid email");

            // Act
            await sut.CreateUserCommand.Execute();

            // Assert
            _messageDialog.Received()
            .Show(Arg.Is <ICollection <ValidationResult> >(x => x.Any(r => r.ErrorMessage == "Invalid Email: invalid email")));
            FormShouldBeEmpty();
        }
        public async Task Load_ErrorWhileRetrievingRoles_ShowErrorMessage()
        {
            // Arrange
            var exception = new Exception("Error while retrieving users");

            _roleRepository.When(_ => _.GetAll()).Throw(exception);

            // Act
            await sut.Load();

            // Assert
            _messageDialog.Received().ShowError(title: General.ErrorLoadingRolesTitle, message: exception.Message);
        }