Пример #1
0
        private void PrepareRetractedState(FarmSolutionDefinition solutionDef,
                                           bool isWebApplication)
        {
            var deployDef = solutionDef.Inherit(def =>
            {
                def.ShouldDelete  = null;
                def.ShouldRetract = null;
                def.ShouldUpgrade = null;

                def.ShouldAdd    = true;
                def.ShouldDeploy = true;
            });

            var retractDef = solutionDef.Inherit(def =>
            {
                def.ShouldDelete  = null;
                def.ShouldDeploy  = null;
                def.ShouldUpgrade = null;

                def.ShouldAdd     = true;
                def.ShouldRetract = true;
            });

            TestFarmSolutionModel(deployDef, isWebApplication);
            TestFarmSolutionModel(retractDef, isWebApplication);
        }
        private void PrepareAddedState(FarmSolutionDefinition solutionDef)
        {
            var addDef = solutionDef.Inherit(def =>
            {
                def.ShouldDelete  = null;
                def.ShouldDeploy  = null;
                def.ShouldUpgrade = null;

                def.ShouldAdd     = true;
                def.ShouldRetract = null;
            });

            TestFarmSolutionModel(addDef);

            var retractDef = solutionDef.Inherit(def =>
            {
                def.ShouldDelete  = null;
                def.ShouldDeploy  = null;
                def.ShouldUpgrade = null;

                def.ShouldAdd     = true;
                def.ShouldRetract = true;
            });

            TestFarmSolutionModel(retractDef);
        }
Пример #3
0
        protected virtual void TestFarmSolutionModel(FarmSolutionDefinition solutionDef, bool isWebApplicationLevel)
        {
            var newSolutiondef = solutionDef.Inherit();

            if (isWebApplicationLevel)
            {
                var originalModel = SPMeta2Model.NewWebApplicationModel(webApp =>
                {
                    webApp.AddFarmSolution(solutionDef);
                });

                var newModel = SPMeta2Model.NewWebApplicationModel(farm =>
                {
                    farm.AddFarmSolution(newSolutiondef);
                });

                TestModel(originalModel);
                TestModel(newModel);
            }
            else
            {
                var originalModel = SPMeta2Model.NewFarmModel(farm =>
                {
                    farm.AddFarmSolution(solutionDef);
                });

                var newModel = SPMeta2Model.NewFarmModel(farm =>
                {
                    farm.AddFarmSolution(newSolutiondef);
                });

                TestModel(originalModel);
                TestModel(newModel);
            }
        }
        private void PrepareDeletedState(FarmSolutionDefinition solutionDef)
        {
            var deletedDef = solutionDef.Inherit(def =>
            {
                def.ShouldDeploy  = null;
                def.ShouldRetract = true;
                def.ShouldUpgrade = null;

                def.ShouldAdd    = false;
                def.ShouldDelete = true;
            });

            TestFarmSolutionModel(deletedDef);
        }
        protected virtual void TestFarmSolutionModel(FarmSolutionDefinition solutionDef)
        {
            var newSolutiondef = solutionDef.Inherit();

            var originalModel = SPMeta2Model.NewFarmModel(farm =>
            {
                farm.AddFarmSolution(solutionDef);
            });

            var newModel = SPMeta2Model.NewFarmModel(farm =>
            {
                farm.AddFarmSolution(newSolutiondef);
            });

            TestModel(originalModel);
            TestModel(newModel);
        }