예제 #1
0
        public void WhithTarget()
        {
            MappedProperty    mp        = Factory.getVanillaTestObject();
            IMappableProperty newTarget = Factory.getMappedPropertyObject();

            mp.Target = newTarget;

            Assert.IsTrue(mp.IsMapped);
        }
예제 #2
0
        public void Vanilla()
        {
            /* setup */
            MappedProperty mp = Factory.getVanillaTestObject();

            /* method to test*/
            IMappableProperty source = mp.Source;

            /* evaluation */
            Assert.IsNull(source);
        }
예제 #3
0
        public void Vanilla()
        {
            /* setup */
            MappedProperty mp = Factory.getVanillaTestObject();

            /* method to test*/
            IMappableProperty target = mp.Target;

            /* evaluation */
            Assert.IsNull(target);
        }
예제 #4
0
        public void SetSourceByMappedProperty()
        {
            /* setup */
            MappedProperty mp = Factory.getVanillaTestObject();

            mp.Source = Factory.getMappedPropertyObject();

            /* method to test*/
            IMappableProperty source = mp.Source;

            /* evaluation */
            Assert.IsNotNull(source);
            Assert.IsTrue(source is MappedProperty);
        }
예제 #5
0
        public void ChangeTargetFromMappedPropertyToNull()
        {
            /* setup */
            MappedProperty mp = Factory.getVanillaTestObject();

            mp.Target = Factory.getMappedPropertyObject();
            mp.Target = null;

            /* method to test*/
            IMappableProperty target = mp.Target;

            /* evaluation */
            Assert.IsNull(target);
        }
예제 #6
0
        public void SetTargetToProperty()
        {
            /* setup */
            MappedProperty mp = Factory.getVanillaTestObject();

            mp.Target = Factory.getPropertyObject();

            /* method to test*/
            IMappableProperty target = mp.Target;

            /* evaluation */
            Assert.IsNotNull(target);
            Assert.IsTrue(target is Property);
        }
예제 #7
0
        public void ChangeSourceFromMappedPropertyToNull()
        {
            /* setup */
            MappedProperty mp = Factory.getVanillaTestObject();

            mp.Source = Factory.getMappedPropertyObject();
            mp.Source = null;

            /* method to test*/
            IMappableProperty source = mp.Source;

            /* evaluation */
            Assert.IsNull(source);
        }
예제 #8
0
        public void ChangeSourceFromMappedPropertyToProcedureProperty()
        {
            /* setup */
            MappedProperty mp = Factory.getVanillaTestObject();

            mp.Source = Factory.getMappedPropertyObject();
            mp.Source = Factory.getProcedurePropertyObject();

            /* method to test*/
            IMappableProperty source = mp.Source;

            /* evaluation */
            Assert.IsNotNull(source);
            Assert.IsTrue(source is ProcedureProperty);
        }
예제 #9
0
        private IMappableProperty FindTarget(IMappableProperty source)
        {
            foreach (IMappableProperty targetProperty in TargetProperties)
            {
                if (targetProperty is UXSessionProperty)
                {
                    continue;
                }

                if ((targetProperty.Name == source.Name) && (targetProperty.Type == source.Type))
                {
                    return(targetProperty);
                }
            }

            return(null);
        }
예제 #10
0
        public void AutoMapProperties()
        {
            foreach (ListViewItem item in propertyListView.Items)
            {
                MappedProperty property = item.Tag as MappedProperty;
                if (property != null)
                {
                    IMappableProperty target = FindTarget(property.Source);
                    bool hasTarget           = target != null;

                    if (property.IsEnabled && !property.IsMapped && hasTarget)
                    {
                        property.Target = target;
                        UpdateListItem(item);
                    }
                }
            }
            RefreshView();
        }
예제 #11
0
        void TargetPropertyClickEventHandler(object sender, EventArgs e)
        {
            if (propertyListView.SelectedItems.Count == 1)
            {
                MappedProperty property = propertyListView.SelectedItems[0].Tag as MappedProperty;

                IMappableProperty target = (sender as ToolStripMenuItem).Tag as IMappableProperty;

                if (target != null)
                {
                    property.Target    = target;
                    property.IsEnabled = true;
                }
                else
                {
                    property.Target = null;
                }

                UpdateListItem(propertyListView.SelectedItems[0]);
            }
        }
예제 #12
0
        private void MapProperty(MappedProperty mappedProperty, IMappableProperty sourceProperty)
        {
            bool newMappedProperty = false;

            if (mappedProperty == null)
            {
                mappedProperty             = new MappedProperty();
                mappedProperty.Source      = sourceProperty;
                mappedProperty.Sequence    = PropertyMap.MappedProperties.Count + 1;
                mappedProperty.PropertyMap = PropertyMap;
                PropertyMap.MappedProperties.Add(mappedProperty);
                newMappedProperty = true;
            }

            if (newMappedProperty)
            {
                mappedProperty.IsEnabled = EnablePropertiesByDefault;
            }

            ListViewItem item = CreateListItem(mappedProperty);

            UpdateListItem(item);
        }