public void CanNotDelete() { // Arrange ClientEditState clientEditState = this.GetDefaultState(); // Assert clientEditState.CanDelete().Should().BeFalse(); }
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 CanCommitAndSave() { // Arrange ClientEditState clientEditState = this.GetDefaultState(); // Assert clientEditState.CanCommit().Should().BeTrue(); clientEditState.CanCancel().Should().BeTrue(); }
public void CanNotSwitchToOtherModes() { // Arrange ClientEditState clientEditState = this.GetDefaultState(); // Assert clientEditState.CanSwitchToSearchMode().Should().BeFalse(); clientEditState.CanSwitchToAddMode().Should().BeFalse(); clientEditState.CanSwitchToEditMode().Should().BeFalse(); }
public void ReloadClientValuesAndChangeToClientLoadedState() { // Arrange Mock <ClientEditViewModel> mockClientEditViewModel = this.GetMockedViewModel(); ClientEditState clientEditState = this.GetDefaultState(mockClientEditViewModel); // Act clientEditState.Cancel(); // Assert mockClientEditViewModel.Verify(x => x.Load(It.IsAny <int>()), Times.Once); }
public async Task SendUpdateClientValuesMessageWhenClientWasSavedSuccessfully() { // Arrange Mock <ClientEditViewModel> mockClientEditViewModel = this.GetMockedViewModel(); mockClientEditViewModel.Setup(x => x.SaveOrUpdateClientAsync()).Returns(Task.FromResult(true)); ClientEditState clientEditState = this.GetDefaultState(mockClientEditViewModel); // Act await clientEditState.Commit(); // Assert mockClientEditViewModel.Verify(x => x.SendUpdateClientValuesMessage(), Times.Once); }
public async Task DoNotChangeToClientLoadedStateWhenClientWasNotSavedSuccessfully() { // Arrange Mock <ClientEditViewModel> mockClientEditViewModel = this.GetMockedViewModel(); mockClientEditViewModel.Setup(x => x.SaveOrUpdateClientAsync()).Returns(Task.FromResult(false)); ClientEditState clientEditState = this.GetDefaultState(mockClientEditViewModel); // Act await clientEditState.Commit(); // Assert mockClientEditViewModel.Verify(x => x.ChangeToLoadedMode(null), Times.Never); }