// Public Methods (1) 

        /// <summary>
        /// The data to render.
        /// </summary>
        /// <returns></returns>
        public IEnumerable <IList <CellData> > Rows()
        {
            if (_listOfRows == null)
            {
                yield break;
            }

            foreach (var item in _listOfRows)
            {
                var list = new DumpNestedProperties().DumpPropertyValues(item, string.Empty, _dumpLevel);
                yield return(list);
            }
        }
        private void processNormalProperties(ICollection <CellData> list, object columnObject)
        {
            var dataList = new DumpNestedProperties().DumpPropertyValues(columnObject, string.Empty, _dumpLevel);

            foreach (var item in dataList)
            {
                if (item == null)
                {
                    continue;
                }
                list.Add(item);
            }
        }
Exemple #3
0
        public void Test_Employee_Has_6_Items_Run1()
        {
            var obj = new Employee
            {
                Id          = 1,
                Name        = "Name 1",
                Age         = 23,
                Department  = "Dep 1",
                Salary      = 2300,
                WorkedHours = "08:00"
            };

            var results = new DumpNestedProperties().DumpPropertyValues(obj);

            Assert.AreEqual(expected: 6, actual: results.Count);
            Assert.AreEqual(expected: "Name 1", actual: results.First(x => x.PropertyName == "Name").PropertyValue);
        }
Exemple #4
0
        public void Test_TopLevel_Has_6_Items_Run1()
        {
            var obj = new TopLevel
            {
                Id         = 1,
                Name       = "Name 1",
                LastName   = "Last Name 1",
                NestedType = new NestedType
                {
                    Key   = "Key 1",
                    Value = 1
                }
            };

            var results = new DumpNestedProperties().DumpPropertyValues(obj);

            Assert.AreEqual(expected: 6, actual: results.Count);
            Assert.AreEqual(expected: "Last Name 1", actual: results.First(x => x.PropertyName == "LastName").PropertyValue);
            Assert.AreEqual(expected: "Key 1", actual: results.First(x => x.PropertyName == "NestedType.Key").PropertyValue);
        }