Пример #1
0
        public void TestWithAll()
        {
            var c = new ClassToTestEnumerables
            {
                Case1 = new[] { 1, 2 },
                Case2 = new[] { 3, 4 },
                Case3 = new List <int> {
                    5, 6
                },
                Case4 = new[] { 7, 8 },
                Case5 = new[] { 9, 10 },
                Case6 = new List <int> {
                    11, 12
                }
            };

            c.DeeperF = c;
            c.DeeperP = c;
            var t      = new InMemoryTableManager();
            var export = new DataExtract <ClassToTestEnumerables>(_spec, t);

            export.Run(c);
            var tables = export.TableManager.GetWithAllData().ToDictionary(_ => _.Name, _ => _.Rows);

            tables.Remove("ClassToTestEnumerables");
            Assert.IsTrue(tables.Values.All(_ => _.Count == 2));
        }
        public void Test()
        {
            var spec = entitySpec.Begin()
                       .Add(entitySpec.Begin("SelfList").NotSaved()
                            .Add("Double"))
                       .Add("AggregatedDouble").Aggregates("SelfList.Double")
                       .Add("FormulaOnAggregate").Formula("2*AggregatedDouble");

            var theTop = new TheTop
            {
                SelfList = new List <TheTop> {
                    new TheTop {
                        Double = 42
                    }, new TheTop {
                        Double = 43
                    }
                }
            };
            var t      = new InMemoryTableManager();
            var export = new DataExtract <TheTop>(spec, t);

            _topEntity = export.TopEntity;
            export.Run(theTop);
            _tables = export.TableManager.GetWithAllData();

            _topTable = _tables.Single(_ => _.Name == "TheTop");
        }
        public void Test()
        {
            var spec = entitySpec.Begin()
                       .Add("FirstName")
                       .Add("AggregatedX").Aggregates("Structs.X")
                       .Add(entitySpec.Begin("Structs").NotSaved()
                            .Add("X"))
                       .Add(entitySpec.Begin("Self.SelfList")
                            .Add("Double"))
                       .Add("AggregatedDouble").Aggregates("Self.SelfList.Double");

            var theTop = new TheTop
            {
                FirstName = "Petronella",
                Structs   = Enumerable.Range(1, 4).Select(_ => new SomeStruct {
                    X = _
                }).ToList(),
                SomeStruct = new SomeStruct {
                    X = 7, Y = 8
                },
                Self = new TheTop
                {
                    SelfList = new List <TheTop> {
                        new TheTop {
                            Double = 42
                        }, new TheTop {
                            Double = 43
                        }
                    }
                }
            };
            var t      = new InMemoryTableManager();
            var export = new DataExtract <TheTop>(spec, t);

            _topEntity = export.TopEntity;
            export.Run(theTop);
            _tables = export.TableManager.GetWithAllData();

            _topTable = _tables.Single(_ => _.Name == "TheTop");
        }