Exemplo n.º 1
0
        public void CanNotDelete()
        {
            // Arrange
            BillEditState billEditState = this.GetDefaultBillEditState();

            // Assert
            billEditState.CanDelete().Should().BeFalse();
        }
Exemplo n.º 2
0
 private void InitBillStateList()
 {
     this._billEmptyState    = new BillEmptyState(this);
     this._billSearchState   = new BillSearchState(this);
     this._billCreationState = new BillCreationState(this);
     this._billLoadedState   = new BillLoadedState(this);
     this._billEditState     = new BillEditState(this);
 }
Exemplo n.º 3
0
        public void CanCommitAndSave()
        {
            // Arrange
            BillEditState billEditState = this.GetDefaultBillEditState();

            // Assert
            billEditState.CanCommit().Should().BeTrue();
            billEditState.CanCancel().Should().BeTrue();
        }
Exemplo n.º 4
0
        public void CanNotSwitchToOtherModes()
        {
            // Arrange
            BillEditState billEditState = this.GetDefaultBillEditState();

            // Assert
            billEditState.CanSwitchToSearchMode().Should().BeFalse();
            billEditState.CanSwitchToEditMode().Should().BeFalse();
        }
Exemplo n.º 5
0
        public void ReloadBillValuesAndChangeToBillLoadedState()
        {
            // Arrange
            Mock <BillEditViewModel> mockBillEditViewModel = this.GetDefaultMockBillEditViewModel();
            BillEditState            billEditState         = this.GetDefaultBillEditState(mockBillEditViewModel);

            // Act
            billEditState.Cancel();

            // Assert
            mockBillEditViewModel.Verify(x => x.Reload(It.IsAny <int>()), Times.Once);
        }
Exemplo n.º 6
0
        public async Task SendUpdateBillValuesMessageWhenBillWasSavedSuccessfully()
        {
            // Arrange
            Mock <BillEditViewModel> mockBillEditViewModel = this.GetDefaultMockBillEditViewModel();

            mockBillEditViewModel.Setup(x => x.SaveOrUpdateBillAsync()).Returns(Task.FromResult(true));

            BillEditState billEditState = this.GetDefaultBillEditState(mockBillEditViewModel);

            // Act
            await billEditState.Commit();

            // Assert
            mockBillEditViewModel.Verify(x => x.SendUpdateBillValuesMessage(), Times.Once);
        }
Exemplo n.º 7
0
        public async Task DoNotChangeToBillLoadedStateWhenBillWasNotSavedSuccessfully()
        {
            // Arrange
            Mock <BillEditViewModel> mockBillEditViewModel = this.GetDefaultMockBillEditViewModel();

            mockBillEditViewModel.Setup(x => x.SaveOrUpdateBillAsync()).Returns(Task.FromResult(false));

            BillEditState billEditState = this.GetDefaultBillEditState(mockBillEditViewModel);

            // Act
            await billEditState.Commit();

            // Assert
            mockBillEditViewModel.Verify(x => x.ChangeToLoadedMode(null), Times.Never);
        }