Esempio n. 1
0
        public void AssignRulesToEntities()
        {
            JarsResource resource = FakeDataHelper.FakeResources[0];

            JarsJob testJob = FakeDataHelper.FakeJarsJobs[1];

            //set up a rule for a target entity where target entity can not be changed
            IJarsRule singleEntityRule = JarsRulePopupForm.AddRuleOnEntity(resource, testJob.GetType());

            Assert.IsTrue(!string.IsNullOrEmpty(singleEntityRule.TargetCriteriaString));

            ////set up a rule for an entity type instead of a certain entity
            //IEntityRule singleTypeRule = EntityRuleForm.AddRuleOnEntity(resource);
            //Assert.IsTrue(singleTypeRule.TargetTypeName == typeof(Resource).Name && singleTypeRule.SourceTypeName == typeof(Resource).Name);


            ////set up a rule for an entity type that relies on values from another entity type
            //IEntityRule linkedTypeRule = EntityRuleForm.AddRuleOnEntity(resource, typeof(JarsJob));
            //Assert.IsTrue(linkedTypeRule.TargetTypeName == typeof(Resource).Name
            //    && linkedTypeRule.SourceTypeName == typeof(JarsJob).Name
            //    && !string.IsNullOrEmpty(linkedTypeRule.SourceCriteriaString)
            //    && !string.IsNullOrEmpty(linkedTypeRule.TargetCriteriaString));


            singleEntityRule = JarsRulePopupForm.EditRuleOnEntity(resource, singleEntityRule);
            Assert.IsTrue(!string.IsNullOrEmpty(singleEntityRule.TargetCriteriaString));
        }
Esempio n. 2
0
 private void btnEditCondition_Click(object sender, EventArgs e)
 {
     if (defaultBindingSource.Current is JarsResource)
     {
         IJarsRule ec = entityRuleBindingSource.Current as JarsRule;
         ec = JarsRulePopupForm.EditRuleOnEntity(defaultBindingSource.Current as JarsResource, ec);
         OnSaveEntityRule(ec as JarsRule);
     }
 }
Esempio n. 3
0
 private void btnAddCondition_Click(object sender, EventArgs e)
 {
     if (defaultBindingSource.Current is JarsResource)
     {
         IJarsRule ec = JarsRulePopupForm.AddRuleOnEntity(defaultBindingSource.Current as JarsResource);
         if (ec != null)
         {
             OnSaveEntityRule(ec as JarsRule);
         }
     }
 }