public async Task DoNotChangeToClientLoadedStateWhenClientWasNotAddedSuccessfully() { // Arrange Mock <ClientEditViewModel> mockClientEditViewModel = this.GetMockedViewModel(); mockClientEditViewModel.Setup(x => x.SaveOrUpdateClientAsync()).Returns(Task.FromResult(false)); ClientCreationState clientCreationState = this.GetDefaultState(mockClientEditViewModel); // Act await clientCreationState.Commit(); // Assert mockClientEditViewModel.Verify(x => x.ChangeToLoadedMode(null), Times.Never); }
public async Task SendReloadClientSearchMessageWhenClientWasAddedSuccessfully() { // Arrange Mock <ClientEditViewModel> mockClientEditViewModel = this.GetMockedViewModel(); mockClientEditViewModel.Setup(x => x.SaveOrUpdateClientAsync()).Returns(Task.FromResult(true)); NotificationMessage notificationMessage = null; Messenger.Default.Register <NotificationMessage>(this, x => notificationMessage = x); ClientCreationState clientCreationState = this.GetDefaultState(mockClientEditViewModel); // Act await clientCreationState.Commit(); // Assert notificationMessage.Should().NotBeNull(); notificationMessage.Notification.Should().Be(Resources.Message_ReloadClientsForClientSearchVM); }