Example #1
0
        private void SwapEnvironments(DeployEnvironment firstEnvironmentToSwap, DeployEnvironment secondEnvironmentToSwap)
        {
            var sortOrder = firstEnvironmentToSwap.SortOrder;

            firstEnvironmentToSwap.SortOrder  = secondEnvironmentToSwap.SortOrder;
            secondEnvironmentToSwap.SortOrder = sortOrder;
        }
Example #2
0
        private void MoveRight(DeployEnvironment environment)
        {
            var index = DeploymentEnvironments.IndexOf(environment);

            if (!EnvironmentIsInTheLastPosition(index))
            {
                var rightEnvironment = DeploymentEnvironments[index + 1];
                SwapEnvironments(environment, rightEnvironment);
            }
        }
Example #3
0
        private void MoveLeft(DeployEnvironment environment)
        {
            var index = DeploymentEnvironments.IndexOf(environment);

            if (!EnvironmentIsInTheFirstPosition(index))
            {
                var leftEnvironment = DeploymentEnvironments[index - 1];
                SwapEnvironments(environment, leftEnvironment);
            }
        }
Example #4
0
        public void AddDeployEnvironment(string name, bool defaultToggleValue, bool requireReasonWhenToggleEnabled, bool requireReasonWhenToggleDisabled, int sortOrder = 1)
        {
            if (DeployEnvExists(name))
            {
                throw new BusinessRuleValidationException("Environment with the same name already exists for this application!");
            }

            DeploymentEnvironments.Add(DeployEnvironment.Create(name, defaultToggleValue, requireReasonWhenToggleEnabled, requireReasonWhenToggleDisabled, sortOrder));

            foreach (var ft in FeatureToggles)
            {
                ft.AddStatus(defaultToggleValue, name);
            }
        }