public void NavigateToUsersView_AfterOpeningAndClosingIt_OpenTheView()
        {
            // Arrange
            Action <ViewClosedEvent> onClosedEvent = null;

            _eventAggregator.GetAction <ViewClosedEvent>(action => onClosedEvent = action);
            var viewModel = CreateViewModel();

            viewModel.NavigateToUsersView();
            onClosedEvent(ViewClosedEvent.Create <UsersView, UsersViewModel>());

            // Act
            viewModel.NavigateToUsersView();

            // Assert
            _viewNavigator.Received(2).Open <UsersViewModel>();
        }
        public async Task UserIsCreated_AddToUserListAndShowSnackbarMessage()
        {
            // Arrange
            var createdUser = MakeUser();
            Action <UserCreatedEvent> onUserCreatedEvent = null;

            _eventAggregator.GetAction <UserCreatedEvent>(action => onUserCreatedEvent = action);
            var viewModel = CreateUserViewModel(); // Needed because it subscribes to the events in the constructor

            onUserCreatedEvent(new UserCreatedEvent(createdUser));

            // Act
            await viewModel.Load();

            // Assert
            viewModel.Users.Should()
            .HaveCount(1)
            .And.ContainEquivalentOfMapped(createdUser, _mapper);
            _snackbarMessage.Received().Show(
                message: string.Format(General.UserCreatedMessage, createdUser.FirstName, createdUser.Id));
        }