コード例 #1
0
        public void NestedTest()
        {
            var templete = @"
[@OrderId,@Price] @Name @CreateDate
@Products

#Products{
    @Id @Code @Name}
#Products$header{head@count }
#Products$footer{
foot@count }";

            var entity = new TestOrder();

            entity.OrderId    = TestHelper.RandomizeInt();
            entity.Price      = TestHelper.RandomizeInt() * TestHelper.RandomizeInt();
            entity.Name       = string.Concat("name-", TestHelper.RandomizeString());
            entity.CreateDate = DateTime.Now;
            entity.Products   = new List <TestProduct>()
            {
                new TestProduct()
                {
                    Id = TestHelper.RandomizeInt(), Code = string.Concat("code-", TestHelper.RandomizeString()), Name = string.Concat("name-", TestHelper.RandomizeString())
                },
                new TestProduct()
                {
                    Id = TestHelper.RandomizeInt(), Code = string.Concat("code-", TestHelper.RandomizeString()), Name = string.Concat("name-", TestHelper.RandomizeString())
                }
            };
            Console.WriteLine(entity.ToText(templete));
            Console.WriteLine("============");
        }