public void CanCommit() { // Arrange ClientCreationState clientCreationState = this.GetDefaultState(); // Assert clientCreationState.CanCommit().Should().BeTrue(); }
private void InitStates() { this._clientEmptyState = new ClientEmptyState(this); this._clientSearchState = new ClientSearchState(this); this._clientCreationState = new ClientCreationState(this); this._clientLoadedState = new ClientLoadedState(this); this._clientEditState = new ClientEditState(this); }
public void CanNotDelete() { // Arrange ClientCreationState clientCreationState = this.GetDefaultState(); // Assert clientCreationState.CanDelete().Should().BeFalse(); }
public void CanNotSwitchToOtherModes() { // Arrange ClientCreationState clientCreationState = this.GetDefaultState(); // Assert clientCreationState.CanSwitchToSearchMode().Should().BeFalse(); clientCreationState.CanSwitchToAddMode().Should().BeFalse(); clientCreationState.CanSwitchToEditMode().Should().BeFalse(); }
public void ReturnToPreviousClientAndClientState() { // Arrange Mock <ClientEditViewModel> mockClientEditViewModel = this.GetMockedViewModel(); ClientCreationState clientCreationState = this.GetDefaultState(mockClientEditViewModel); // Act clientCreationState.Cancel(); // Assert mockClientEditViewModel.Verify(x => x.ChangeToEmptyMode(), Times.Once); }
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); }