public void Test()
        {
            var spec = entitySpec.Begin()
                       .Add(entitySpec.Begin("DictionariesAreSneaky")
                            .Add("KeyValue").Formula("Key+Value")
                            .Add("Key").NotSaved()
                            .Add("Value").NotSaved());
            var x = new TestClassWithSneakyStuff
            {
                DictionariesAreSneaky = new Dictionary <int, int>
                {
                    { 1, 99 }, { 5, 15 }
                }
            };

            var export = new DataExtract <TestClassWithSneakyStuff>(spec);

            export.Run(x);

            var t = export.TableManager.GetWithAllData().Single(_ => _.Name == "DictionariesAreSneaky");

            CollectionAssert.AreEquivalent(new[] { 100, 20 }, t.Rows.Select(_ => _.Columns.Single()));
        }
示例#2
0
        public void SetUp()
        {
            var spec   = entitySpec.Begin().Add("*");
            var export = new DataExtract <TestClassWithSneakyStuff>(spec);

            _entity = export.TopEntity;

            var tcwss = new TestClassWithSneakyStuff
            {
                TheStruct = new SomeStruct {
                    X = 12, Y = 19
                },
                TheList = new SneakyList {
                    NonObviousProperty = 56
                }
            };

            tcwss.TheList.AddRange(new[] { "Straight", "to", "the", "heart" });
            export.Run(tcwss);
            var table = export.TableManager.GetWithAllData();

            _topTable = table.Single(_ => _.Name == "TestClassWithSneakyStuff");
            _subTable = table.Single(_ => _.Name == "TheList");
        }