public void RemoveByName()
        {
            MutablePropertyValues props = new MutablePropertyValues();

            props.Add(new PropertyValue("Name", "Fiona Apple"));
            props.Add(new PropertyValue("Age", 24));
            Assert.AreEqual(2, props.PropertyValues.Count);
            props.Remove("name");
            Assert.AreEqual(1, props.PropertyValues.Count);
        }
        public void RemoveByPropertyValue()
        {
            MutablePropertyValues props    = new MutablePropertyValues();
            PropertyValue         propName = new PropertyValue("Name", "Fiona Apple");

            props.Add(propName);
            props.Add(new PropertyValue("Age", 24));
            Assert.AreEqual(2, props.PropertyValues.Length);
            props.Remove(propName);
            Assert.AreEqual(1, props.PropertyValues.Length);
        }
        public void ChangesSinceWithSelf()
        {
            IDictionary <string, object> map = new Dictionary <string, object>();

            map.Add("Name", "Fiona Apple");
            map.Add("Age", 24);
            MutablePropertyValues props = new MutablePropertyValues(map);

            props.Remove("name");
            // get all of the changes between self and self again (there should be none);
            IPropertyValues changes = props.ChangesSince(props);

            Assert.AreEqual(0, changes.PropertyValues.Count);
        }
 public void ChangesSinceWithSelf () 
 {
     IDictionary<string, object> map = new Dictionary<string, object>();
     map.Add("Name", "Fiona Apple");
     map.Add ("Age", 24);
     MutablePropertyValues props = new MutablePropertyValues (map);
     props.Remove ("name");
     // get all of the changes between self and self again (there should be none);
     IPropertyValues changes = props.ChangesSince (props);
     Assert.AreEqual (0, changes.PropertyValues.Count);
 }
 public void RemoveByPropertyValue () 
 {
     MutablePropertyValues props = new MutablePropertyValues ();
     PropertyValue propName = new PropertyValue ("Name", "Fiona Apple");
     props.Add (propName);
     props.Add (new PropertyValue ("Age", 24));
     Assert.AreEqual (2, props.PropertyValues.Count);
     props.Remove (propName);
     Assert.AreEqual (1, props.PropertyValues.Count);
 }
 public void RemoveByName()
 {
     MutablePropertyValues props = new MutablePropertyValues ();
     props.Add (new PropertyValue ("Name", "Fiona Apple"));
     props.Add (new PropertyValue ("Age", 24));
     Assert.AreEqual (2, props.PropertyValues.Length);
     props.Remove ("name");
     Assert.AreEqual (1, props.PropertyValues.Length);
 }
예제 #7
0
 /// <summary> 
 /// Create the job instance, populating it with property values taken
 /// from the scheduler context, job data map and trigger data map.
 /// </summary>
 protected override object CreateJobInstance(TriggerFiredBundle bundle)
 {
     ObjectWrapper ow = new ObjectWrapper(bundle.JobDetail.JobType);
     if (IsEligibleForPropertyPopulation(ow.WrappedInstance))
     {
         MutablePropertyValues pvs = new MutablePropertyValues();
         if (schedulerContext != null)
         {
             pvs.AddAll(schedulerContext);
         }
         pvs.AddAll(bundle.JobDetail.JobDataMap);
         pvs.AddAll(bundle.Trigger.JobDataMap);
         if (ignoredUnknownProperties != null)
         {
             for (int i = 0; i < ignoredUnknownProperties.Length; i++)
             {
                 string propName = ignoredUnknownProperties[i];
                 if (pvs.Contains(propName))
                 {
                     pvs.Remove(propName);
                 }
             }
             ow.SetPropertyValues(pvs);
         }
         else
         {
             ow.SetPropertyValues(pvs, true);
         }
     }
     return ow.WrappedInstance;
 }