Beispiel #1
0
        public void ReflectPropertyInfoList()
        {
            Setup.TimerStart($"==>{Setup.CallerName()} Started");
            var lst = SdcUtil.ReflectPropertyInfoList(Setup.FD);

            foreach (var n in lst)
            {
                Debug.Print($"{n.XmlOrder}:\t Name: {n.PropertyInfo.Name}, \t Type: {n.PropertyInfo.PropertyType.Name}");
            }
            Setup.TimerPrintSeconds("  seconds: ", $"\r\n<=={Setup.CallerName()} Complete");
        }
Beispiel #2
0
        public void GetPropertyInfoMetadata_Complete()
        {
            Setup.TimerStart($"==>{Setup.CallerName()} Started");
            Stopwatch.StartNew();
            var a = Stopwatch.GetTimestamp();

            foreach (var n in Setup.FD.Nodes)
            {
                SdcUtil.GetPropertyInfo(n.Value);
                //Debug.Print(ISdcUtil.GetPropertyInfo(n.Value).ToString());
            }
            Debug.Print(((((float)Stopwatch.GetTimestamp() - a) / Stopwatch.Frequency) / Setup.FD.Nodes.Count()).ToString());
            Setup.TimerPrintSeconds("  seconds: ", $"\r\n<=={Setup.CallerName()} Complete");
        }
Beispiel #3
0
        public void ReflectNodeDictionariesOrdered()
        {
            Setup.TimerStart($"==>{Setup.CallerName()} Started");
            SdcUtil.ReflectNodeDictionariesOrdered(Setup.FD);
            Setup.TimerPrintSeconds("  seconds: ", $"\r\n<=={Setup.CallerName()} Complete");

            Setup.TimerStart($"==>{Setup.CallerName()} Started");
            SdcUtil.ReflectNodeDictionariesOrdered(Setup.FD);
            Setup.TimerPrintSeconds("  seconds: ", $"\r\n<=={Setup.CallerName()} Complete");

            Setup.TimerStart($"==>{Setup.CallerName()} Started");
            var s = SdcUtil.ReflectNodeDictionariesOrdered(Setup.FD, true);

            Setup.TimerPrintSeconds("  seconds: ", $"\r\n<=={Setup.CallerName()} Complete");
            Debug.Print(s);
        }
Beispiel #4
0
        public void GetPropertyInfoMetadata()
        { //given an SDC item, find the property that references it in the item.ParentNode class
            Setup.TimerStart($"==>{Setup.CallerName()} Started");
            var t = (ITopNode)Setup.FD;

            var qList = t.Nodes.Where(n => n.Value is QuestionItemType).Select(n => n.Value).ToList();
            var sList = t.Nodes.Where(n => n.Value is SectionItemType).Select(n => n.Value).ToList();
            var aList = t.Nodes.Where(n => n.Value is ListItemType).Select(n => n.Value).ToList();
            var cList = t.Nodes.Where(n => n.Value is ChildItemsType).Select(n => n.Value).ToList();
            var pList = t.Nodes.Where(n => n.Value is PropertyType).Select(n => n.Value).ToList();


            Debug.Print(SdcUtil.GetPropertyInfo(qList[1]).ToString());
            Debug.Print(SdcUtil.GetPropertyInfo(sList[1]).ToString());
            Debug.Print(SdcUtil.GetPropertyInfo(aList[1]).ToString());
            Debug.Print(SdcUtil.GetPropertyInfo(cList[1]).ToString());
            Debug.Print(SdcUtil.GetPropertyInfo(pList[1]).ToString());
            Debug.Print(SdcUtil.GetPropertyInfo(qList[10]).ToString());
            Debug.Print(SdcUtil.GetPropertyInfo(sList[10]).ToString());
            Debug.Print(SdcUtil.GetPropertyInfo(aList[10]).ToString());
            Debug.Print(SdcUtil.GetPropertyInfo(cList[10]).ToString());
            Debug.Print(SdcUtil.GetPropertyInfo(pList[10]).ToString());
            Setup.TimerPrintSeconds("  seconds: ", $"\r\n<=={Setup.CallerName()} Complete");
        }
Beispiel #5
0
        public void MoveListItemToOtherList()
        {
            Setup.TimerStart($"==>{Setup.CallerName()} Started");
            var li = Setup.FD.Nodes.Where(n =>
                                          n.Value is ListItemType liTest &&
                                          liTest.ID == "38493.100004300").FirstOrDefault().Value
                     as ListItemType;

            Assert.IsTrue(li is ListItemType);
            var list = (ListType)li.ParentNode;

            var list2 = Setup.FD.Nodes.Where(n =>
                                             n.Value is ListType liTest &&
                                             liTest.name == "lst_58267_3").FirstOrDefault().Value
                        as ListType;

            Assert.IsTrue(list2 is ListType);

            //Move to different List (list2)
            li.Move(list2, 2);
            Assert.IsTrue(SdcUtil.GetPropertyInfo(li).ItemIndex == 2);
            Assert.AreEqual(list2, li.ParentNode);
            Setup.TimerPrintSeconds("  seconds: ", $"\r\n<=={Setup.CallerName()} Complete");
        }
Beispiel #6
0
        public void MoveListItemInList()
        {
            Setup.TimerStart($"==>{Setup.CallerName()} Started");
            //FD.TopNode.ReorderNodes();
            var li = Setup.FD.Nodes.Where(n =>
                                          n.Value is ListItemType liTest &&
                                          liTest.ID == "38493.100004300").FirstOrDefault().Value
                     as ListItemType;

            Assert.IsTrue(li is ListItemType);

            List <BaseType> lst1;
            List <BaseType> lst2;
            List <BaseType> lst3;

            lst1 = SdcUtil.ReflectChildList(Setup.FD.GetListItemByID("51689.100004300"));
            lst2 = SdcUtil.ReflectChildList(Setup.FD.GetListItemByID("38493.100004300"));
            lst3 = SdcUtil.ReflectChildList(Setup.FD.GetItemByName("lst_44135_3"));

            lst3 = SdcUtil.ReflectSubtree(Setup.FD.GetSectionByID("43969.100004300"));
            //foreach (var n in lst3) Debug.Print(n.name);
            var tc = new TreeComparer();

            lst3.Sort(tc);
            foreach (var n in lst3)
            {
                Debug.Print(n.name + ": " + n.ElementName + ", " + n.ObjectID);
            }

            var lst4 = Setup.FD.Nodes.Values.ToList();
            var res  = lst4[0].GetType().GetProperties()
                       .Where(p => p.GetCustomAttributes <XmlElementAttribute>().Count() > 0 && p.GetValue(lst4[0]) != null)
                       .Select(p => p.GetValue(lst4[0])).ToList();

            var propList = new List <BaseType>();

            while (false)
            {
                foreach (object o in res)
                {
                    var bt = o as BaseType;
                    if (bt != null)
                    {
                        Debug.Print(bt.name);
                        propList.Add(bt);
                    }
                    else
                    if (o is IList il)
                    {
                        foreach (var n in il.OfType <BaseType>())
                        {
                            Debug.Print(n.name);
                            propList.Add(n);
                        }
                    }
                }
            }

            propList.Sort(new TreeComparer());
            int i = 0;

            foreach (var n in propList)
            {
                Debug.Print((i++).ToString() + ": " + n.name);
            }

            SdcUtil.ReflectSubtree(lst4[0], true, true);
            foreach (var n in lst4)
            {
                Debug.Print(n.name + ": " + n.ElementName + ", " + n.ObjectID.ToString() + ", order:" + n.order.ToString());
            }


            lst4.Sort(tc);
            var list = (ListType)li.ParentNode;



            li.Move(list, 6);
            Assert.IsTrue(SdcUtil.GetPropertyInfo(li).ItemIndex == 6);

            li.Move(list, 99);
            Assert.IsTrue(SdcUtil.GetPropertyInfo(li).ItemIndex == list.Items.Count() - 1);

            li.Move(list, 0);
            Assert.IsTrue(SdcUtil.GetPropertyInfo(li).ItemIndex == 0);

            li.Move(list);
            Assert.IsTrue(SdcUtil.GetPropertyInfo(li).ItemIndex == list.Items.Count() - 1);
            Setup.TimerPrintSeconds("  seconds: ", $"\r\n<=={Setup.CallerName()} Complete");
        }