public void SetInitialValuesTest_disabled()
            {
                IPlanElementUtils pUtils = new PlanElementUtils();
                var pe = new AD.PlanElement {
                    Enabled = false
                };
                var id = "999999999999999999999999";

                pUtils.SetInitialValues(id, pe);

                Assert.AreNotEqual(pe.AssignDate, null);
            }
            public void InitializePlanElementSettings_false()
            {
                IPlanElementUtils pUtils = new PlanElementUtils();

                AD.PlanElement pe = new AD.PlanElement {
                    Enabled = false
                };
                pUtils.InitializePlanElementSettings(pe, pe, new AD.Program {
                    AssignToId = "999999999999999999999999"
                });
                Assert.AreNotEqual(pe.AssignDate, null);
            }
            public void SetProgramAttributes_DoNot_Set_Program_State_state_1()
            {
                IPlanElementUtils pUtils = new PlanElementUtils {
                    ProgramAttributeStrategy = new ProgramAttributeStrategy()
                };
                var pe = new AD.PlanElement {
                    Enabled = false
                };
                var progAttr = new ProgramAttributeData();
                var prog     = new AD.Program {
                    Name = "test"
                };

                pUtils.SetProgramAttributes(new AD.SpawnElement {
                    Tag = "1", ElementType = 10, ElementId = "1234"
                }, prog, "user", progAttr);

                Assert.AreEqual(0, prog.ElementState);
            }
 public void SetProgramAttributes_Null_attributes()
 {
     try
     {
         IPlanElementUtils pUtils = new PlanElementUtils();
         AD.PlanElement    pe     = new AD.PlanElement {
             Enabled = false
         };
         pUtils.SetProgramAttributes(new AD.SpawnElement {
             Tag = "0", ElementType = 19, ElementId = "1234"
         },
                                     new AD.Program {
             Name = "test"
         }, "user", null);
     }
     catch (Exception ex)
     {
         Assert.IsTrue(ex != null);
     }
 }
            public void Update_Action_Assign_To()
            {
                IPlanElementUtils pUtils = new PlanElementUtils();

                var targetAction = ObjectId.GenerateNewId().ToString();

                AD.Program prog = new AD.Program
                {
                    Id      = ObjectId.GenerateNewId().ToString(),
                    Modules = new List <AD.Module>
                    {
                        new AD.Module
                        {
                            Id      = ObjectId.GenerateNewId().ToString(),
                            Actions = new List <AD.Actions>
                            {
                                new AD.Actions
                                {
                                    Id           = targetAction,
                                    ElementState = 2
                                },
                                new AD.Actions
                                {
                                    Id = ObjectId.GenerateNewId().ToString()
                                }
                            }
                        },
                        new AD.Module
                        {
                            Id      = ObjectId.GenerateNewId().ToString(),
                            Actions = new List <AD.Actions>
                            {
                                new AD.Actions
                                {
                                    Id = ObjectId.GenerateNewId().ToString()
                                },
                                new AD.Actions
                                {
                                    Id = ObjectId.GenerateNewId().ToString()
                                }
                            }
                        },
                    }
                };

                var assignToId = ObjectId.GenerateNewId().ToString();

                AD.PlanElement pe = new AD.PlanElement
                {
                    Id         = targetAction,
                    AssignToId = assignToId
                };

                var planElems = new DTO.PlanElements
                {
                    Actions  = new List <DTO.Actions>(),
                    Modules  = new List <DTO.Module>(),
                    Programs = new List <DTO.Program>(),
                    Steps    = new List <DTO.Step>()
                };

                pUtils.UpdatePlanElementAttributes(prog, pe, "111111111111111111111111", planElems);

                Assert.AreEqual(assignToId, prog.Modules[0].Actions[0].AssignToId);
            }