public virtual void AssertViewStateHistory(string testName, IList <DBVersionsViewStateType> viewStateHistory, DBVersionsViewStateType finalViewState)
 {
     Assert.That(viewStateHistory.Count == 2, $"{testName} >>> Number of process ViewStates should be 2, but was {viewStateHistory.Count}");
     Assert.That(viewStateHistory[0] == DBVersionsViewStateType.InProcess, $"{testName} >>> ViewState 1 should be {DBVersionsViewStateType.InProcess}, but was '{viewStateHistory[0]}'");
     Assert.That(viewStateHistory[1] == finalViewState, $"{testName} >>> ViewState 2 should be {finalViewState}, but was '{viewStateHistory[1]}'");
 }
        public void ChangeViewState(DBVersionsViewStateType viewType)
        {
            _dbVersionsViewSateManager.ChangeViewState(viewType);

            ChangeViewStateForMockSniffer(LastViewState);
        }
 public virtual void ChangeViewStateForMockSniffer(DBVersionsViewStateType viewType)
 {
 }
        public void ChangeViewState(DBVersionsViewStateType viewType)
        {
            LastViewState = viewType;

            _dbVersionsControls.LblProjectNameText = $"{_dbVersionsViewModelData.ProjectConfig.Id} - {_dbVersionsViewModelData.ProjectConfig.Description}";

            if (_dbVersionsViewModelData.ScriptFilesState == null)
            {
                _dbVersionsViewModelData.IncrementalScriptFiles = new List <RuntimeScriptFile>();
                _dbVersionsControls.LblIncNumOfExecutedText     = "0";
                _dbVersionsControls.LblIncNumOfVirtualText      = "0";
                _dbVersionsControls.LblIncNumOfChangedText      = "0";

                _dbVersionsViewModelData.RepeatableScriptFiles = new List <RuntimeScriptFile>();
                _dbVersionsControls.LblRptNumOfExecutedText    = "0";
                _dbVersionsControls.LblRptNumOfVirtualText     = "0";
                _dbVersionsControls.LblRptNumOfChangedText     = "0";

                _dbVersionsViewModelData.DevDummyDataScriptFiles = new List <RuntimeScriptFile>();
                _dbVersionsControls.LblDDDNumOfExecutedText      = "0";
                _dbVersionsControls.LblDDDNumOfVirtualText       = "0";
                _dbVersionsControls.LblDDDNumOfChangedText       = "0";
            }
            else
            {
                _dbVersionsViewModelData.IncrementalScriptFiles = _dbVersionsViewModelData.ScriptFilesState.IncrementalScriptFilesComparer.AllFileSystemScriptFiles.ToList();
                _dbVersionsControls.LblIncNumOfExecutedText     = _dbVersionsViewModelData.ScriptFilesState.IncrementalScriptFilesComparer.ExecutedFilesActual.Count.ToString(CultureInfo.InvariantCulture);
                _dbVersionsControls.LblIncNumOfVirtualText      = _dbVersionsViewModelData.ScriptFilesState.IncrementalScriptFilesComparer.ExecutedFilesVirtual.Count.ToString(CultureInfo.InvariantCulture);
                _dbVersionsControls.LblIncNumOfChangedText      = _dbVersionsViewModelData.ScriptFilesState.IncrementalScriptFilesComparer.ChangedFiles.Count.ToString(CultureInfo.InvariantCulture);

                _dbVersionsViewModelData.RepeatableScriptFiles = _dbVersionsViewModelData.ScriptFilesState.RepeatableScriptFilesComparer.AllFileSystemScriptFiles.ToList();
                _dbVersionsControls.LblRptNumOfExecutedText    = _dbVersionsViewModelData.ScriptFilesState.RepeatableScriptFilesComparer.ExecutedFilesActual.Count.ToString(CultureInfo.InvariantCulture);
                _dbVersionsControls.LblRptNumOfVirtualText     = _dbVersionsViewModelData.ScriptFilesState.RepeatableScriptFilesComparer.ExecutedFilesVirtual.Count.ToString(CultureInfo.InvariantCulture);
                _dbVersionsControls.LblRptNumOfChangedText     = _dbVersionsViewModelData.ScriptFilesState.RepeatableScriptFilesComparer.ChangedFiles.Count.ToString(CultureInfo.InvariantCulture);

                if (_dbVersionsViewModelData.ProjectConfig.DevEnvironment)
                {
                    _dbVersionsViewModelData.DevDummyDataScriptFiles = _dbVersionsViewModelData.ScriptFilesState.DevDummyDataScriptFilesComparer.AllFileSystemScriptFiles.ToList();
                    _dbVersionsControls.LblDDDNumOfExecutedText      = _dbVersionsViewModelData.ScriptFilesState.DevDummyDataScriptFilesComparer.ExecutedFilesActual.Count.ToString(CultureInfo.InvariantCulture);
                    _dbVersionsControls.LblDDDNumOfVirtualText       = _dbVersionsViewModelData.ScriptFilesState.DevDummyDataScriptFilesComparer.ExecutedFilesVirtual.Count.ToString(CultureInfo.InvariantCulture);
                    _dbVersionsControls.LblDDDNumOfChangedText       = _dbVersionsViewModelData.ScriptFilesState.DevDummyDataScriptFilesComparer.ChangedFiles.Count.ToString(CultureInfo.InvariantCulture);
                }
                else
                {
                    _dbVersionsViewModelData.DevDummyDataScriptFiles = new List <RuntimeScriptFile>();
                }
            }


            HideAllActionPanels();



            switch (viewType)
            {
            case DBVersionsViewStateType.ReadyToRunSync:

                _dbVersionsControls.PnlMainActionsVisible             = true;
                _dbVersionsControls.LblColorTargetStateSquareVisible  = false;
                _dbVersionsControls.LblColorTargetStateCaptionVisible = false;


                //if (_dbVersionsViewModelData.IncrementalScriptFiles.Count > 0)
                //{
                //    _dbVersionsViewModelData.TargetIncScriptFileName = _dbVersionsViewModelData.IncrementalScriptFiles.Last().Filename;
                //}

                if (_dbVersionsViewModelData.ProjectConfig.DevEnvironment)
                {
                    if (_dbVersionsViewModelData.ScriptFilesState != null)
                    {
                        _dbVersionsControls.BtnVirtualDDDVisible =
                            _dbVersionsViewModelData.ScriptFilesState.DevDummyDataScriptFilesComparer.AllFileSystemScriptFiles.Count > 0 &&
                            _dbVersionsViewModelData.ScriptFilesState.DevDummyDataScriptFilesComparer.ExecutedFilesAll.Count == 0;
                    }
                }


                _dbVersionsControls.GridToSelectTargetStateEnabled = false;

                SetAllControlsEnableDisable(true);
                break;

            case DBVersionsViewStateType.ReadyToSyncToSpecificState:

                AppendNoneDBTargetState();

                _dbVersionsControls.PnlSyncToSpecificStateVisible     = true;
                _dbVersionsControls.LblColorTargetStateSquareVisible  = true;
                _dbVersionsControls.LblColorTargetStateCaptionVisible = true;

                _dbVersionsControls.PnlRepeatableFilesVisible   = false;
                _dbVersionsControls.PnlDevDummyDataFilesVisible = false;

                _notificationsViewModel.SetAttentionMessage(UITextResources.SyncToSpecificStateInstructions);

                _dbVersionsControls.GridToSelectTargetStateEnabled = true;

                SetAllControlsEnableDisable(true);
                break;

            case DBVersionsViewStateType.NewProject:

                if (_dbVersionsViewModelData.ProjectConfig.DevEnvironment)
                {
                    _dbVersionsControls.PnlInitDBVisible = true;
                    _dbVersionsControls.LblColorTargetStateSquareVisible  = false;
                    _dbVersionsControls.LblColorTargetStateCaptionVisible = false;

                    _dbVersionsControls.GridToSelectTargetStateEnabled = false;

                    SetAllControlsEnableDisable(true);
                }
                else
                {
                    SystemTablesViewState();
                }
                break;

            case DBVersionsViewStateType.MissingSystemTables:
            case DBVersionsViewStateType.HistoryExecutedFilesChanged:

                SystemTablesViewState();
                break;

            case DBVersionsViewStateType.SetVirtual:

                AppendNoneDBTargetState();

                _dbVersionsControls.PnlSetDBStateManuallyVisible      = true;
                _dbVersionsControls.LblColorTargetStateSquareVisible  = true;
                _dbVersionsControls.LblColorTargetStateCaptionVisible = true;

                _dbVersionsControls.PnlRepeatableFilesVisible   = false;
                _dbVersionsControls.PnlDevDummyDataFilesVisible = false;

                _notificationsViewModel.SetAttentionMessage(UITextResources.SetVirtualInstructions);

                _dbVersionsControls.GridToSelectTargetStateEnabled = true;

                SetAllControlsEnableDisable(true);

                break;

            case DBVersionsViewStateType.InProcess:

                SetAllControlsEnableDisable(false);

                break;

            case DBVersionsViewStateType.RestoreDatabaseError:

                SetAllControlsEnableDisable(false);

                _dbVersionsControls.BtnShowHistoricalBackupsEnabled = true;

                _dbVersionsControls.PnlRestoreDBErrorVisible          = true;
                _dbVersionsControls.LblColorTargetStateSquareVisible  = false;
                _dbVersionsControls.LblColorTargetStateCaptionVisible = false;
                break;

            default:
                break;
            }

            _dbVersionsControls.PnlRepeatableFilesVisible   = true;
            _dbVersionsControls.PnlDevDummyDataFilesVisible = _dbVersionsViewModelData.ProjectConfig.DevEnvironment;

            _dbVersionsControls.BtnRecreateDBFromScratchMainVisible      = _dbVersionsViewModelData.ProjectConfig.DevEnvironment;
            _dbVersionsControls.BtnRecreateDBFromScratchSecondaryVisible = _dbVersionsViewModelData.ProjectConfig.DevEnvironment;
            _dbVersionsControls.BtnDeployVisible = _dbVersionsViewModelData.ProjectConfig.DevEnvironment;

            _dbVersionsControls.BtnCreateNewDevDummyDataScriptFileEnabled = _dbVersionsViewModelData.ProjectConfig.DevEnvironment;
        }