コード例 #1
0
        public void Create(string planFile)
        {
            XDocument planDefinition = GetPlanXDocument(planFile);

            PlanEntity plan = GetPlanInformationFromXDocument(planDefinition);

            if (PlanDA.Retrieve(plan.PlanID) != null)
            {
                throw new AppException(String.Format("the given plan '{0}' already exists", plan.PlanID));
            }

            plan.Status     = EntityStatus.Active;
            plan.UpdateTime = DateTime.Now;

            using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions()
            {
                IsolationLevel = System.Transactions.IsolationLevel.RepeatableRead
            }))
            {
                long planID = PlanDA.Create(plan);

                plan.ID = planID;

                BuildPlanScriptReference(plan);

                ts.Complete();
            }
        }
コード例 #2
0
        private void CreateTestingData()
        {
            PlanEntity plan = new PlanEntity()
            {
                PlanID         = UnitTestPlanIdentity,
                Name           = "UnitTestPlan",
                Owner          = "Aries",
                Status         = Framework.Enumeration.EntityStatus.Active,
                UpdateTime     = DateTime.Now,
                ProductVersion = String.Empty,
            };

            UnitTestPlanID = PlanDA.Create(plan);
        }
コード例 #3
0
        public void CreateTest()
        {
            PlanEntity plan = new PlanEntity()
            {
                PlanID         = UnitTestPlanID,
                Name           = "UnitTestPlan",
                Owner          = "Aries",
                Status         = Framework.Enumeration.EntityStatus.Active,
                UpdateTime     = DateTime.Now,
                ProductVersion = String.Empty,
            };

            long result = PlanDA.Create(plan);

            Assert.IsTrue(result > 0);
        }