Exemple #1
0
        public void SubDocuments_MuchData()
        {
            const int CNT = 1000;

            var row = new MuchData
            {
                Address1       = "1782 Zhabovaja Uliza # 2",
                Address2       = "Kv. # 18",
                AddressCity    = "Odessa",
                AddressState   = "Zhopinsk",
                AddressCountry = "Russia",

                Mother = new MyPerzon {
                    Name = "Alla Pugacheva", Age = 56, GDID = new GDID(1, 12, 456), Data = new byte[] { 1, 7, 6, 2, 4 }
                },
                Father = new MyPerzon {
                    Name = "Tsoi Korolenko", Age = 52, GDID = new GDID(21, 2, 2456), Data = new byte[] { 1, 2, 3, 4, 5 }
                },

                Decimals = new decimal[] { 23m, 234m, 12m, 90m, 234m },
                Double   = new double[] { 12.3d, 89.2d, 90d },
                Ints     = new int[]    { 23, 892, 33, 423 },
                Phone    = "22-3-22",

                Invoices = new MyInvoice[]
                {
                    new MyInvoice
                    {
                        GDID  = new GDID(1, 1, 100),
                        Name  = "Dimon Khachaturyan",
                        Date  = new DateTime(1990, 08, 15, 14, 0, 0, DateTimeKind.Utc),
                        Lines = new MyInvoiceLine[]
                        {
                            new MyInvoiceLine {
                                LineNo = 1, Description = "Sosiki", Amount = 12.67m
                            },
                            new MyInvoiceLine {
                                LineNo = 2, Description = "Mylo", Amount = 8.50m
                            },
                            new MyInvoiceLine {
                                LineNo = 3, Description = "Туалетная Бумага 'Зева'", Amount = 9.75m
                            },
                            new MyInvoiceLine {
                                LineNo = 4, Description = "Трусы Мужские", Amount = 3.72m
                            }
                        }
                    },

                    new MyInvoice
                    {
                        GDID  = new GDID(1, 1, 200),
                        Name  = "Karen Matnazarov",
                        Date  = new DateTime(1990, 08, 15, 14, 0, 0, DateTimeKind.Utc),
                        Lines = new MyInvoiceLine[]
                        {
                            new MyInvoiceLine {
                                LineNo = 1, Description = "Sol", Amount = 2.67m
                            },
                            new MyInvoiceLine {
                                LineNo = 2, Description = "Gazeta", Amount = 4.50m
                            },
                        }
                    }
                }
            };

            var sw = System.Diagnostics.Stopwatch.StartNew();

            row.GDID = new GDID(10, 0);
            m_Store.Insert(row);

            for (var i = 1; i < CNT; i++)
            {
                row.GDID = new GDID(10, (ulong)i);
                m_Store.Insert(row);
            }

            var elp = sw.ElapsedMilliseconds;

            Console.WriteLine("Did {0} in {1} ms at {2} ops/sec".Args(CNT, elp, CNT / (elp / 1000d)));


            var row2 = m_Store.LoadDoc(new Query <MuchData>("CRUD.LoadMuchData")
            {
                new Query.Param("id", row.GDID)
            });

            Aver.IsNotNull(row2);

            Aver.AreEqual(row.Address1, row2.Address1);
            Aver.AreEqual(row.Address2, row2.Address2);
            Aver.AreEqual(row.AddressCity, row2.AddressCity);
            Aver.AreEqual(row.AddressState, row2.AddressState);
            Aver.AreEqual(row.AddressCountry, row2.AddressCountry);
            Aver.AreEqual(row.Invoices.Length, row2.Invoices.Length);
        }
Exemple #2
0
        public void SubDocuments_MuchData()
        {
            const int CNT = 1000;

              var row = new MuchData
              {
            Address1 = "1782 Zhabovaja Uliza # 2",
            Address2 = "Kv. # 18",
            AddressCity = "Odessa",
            AddressState = "Zhopinsk",
            AddressCountry = "Russia",

            Mother = new MyPerzon{ Name = "Alla Pugacheva", Age = 56, GDID = new GDID(1,12,456), Data = new byte[]{1,7,6,2,4}  },
            Father = new MyPerzon{ Name = "Tsoi Korolenko", Age = 52, GDID = new GDID(21,2,2456), Data = new byte[]{1,2,3,4,5} },

            Decimals = new decimal[]{ 23m, 234m, 12m, 90m, 234m},
            Double   = new double[] { 12.3d, 89.2d, 90d },
            Ints     = new int[]    { 23, 892,33,423 },
            Phone    = "22-3-22",

            Invoices = new MyInvoice[]
            {
                new MyInvoice
                {
                    GDID = new GDID(1, 1, 100),
                    Name = "Dimon Khachaturyan",
                    Date = new DateTime(1990, 08, 15, 14, 0, 0, DateTimeKind.Utc),
                    Lines = new MyInvoiceLine[]
                    {
                    new MyInvoiceLine{ LineNo = 1, Description = "Sosiki", Amount = 12.67m },
                    new MyInvoiceLine{ LineNo = 2, Description = "Mylo", Amount = 8.50m },
                    new MyInvoiceLine{ LineNo = 3, Description = "Туалетная Бумага 'Зева'", Amount = 9.75m },
                    new MyInvoiceLine{ LineNo = 4, Description = "Трусы Мужские", Amount = 3.72m }
                    }
                },

                new MyInvoice
                {
                    GDID = new GDID(1, 1, 200),
                    Name = "Karen Matnazarov",
                    Date = new DateTime(1990, 08, 15, 14, 0, 0, DateTimeKind.Utc),
                    Lines = new MyInvoiceLine[]
                    {
                    new MyInvoiceLine{ LineNo = 1, Description = "Sol", Amount = 2.67m },
                    new MyInvoiceLine{ LineNo = 2, Description = "Gazeta", Amount = 4.50m },
                    }
                }
            }
              };

              var sw = System.Diagnostics.Stopwatch.StartNew();

              row.GDID =  new GDID(10, 0);
              store.Insert(row);

              for(var i=1; i<CNT; i++)
              {
            row.GDID =  new GDID(10, (ulong)i);
            store.Insert(row);
              }

              var elp = sw.ElapsedMilliseconds;

              Console.WriteLine("Did {0} in {1} ms at {2} ops/sec".Args(CNT, elp, CNT / (elp / 1000d)));

              var row2 = store.LoadRow(new Query<MuchData>("CRUD.LoadMuchData")
                           {
                             new Query.Param("id", row.GDID)
                           });
              Assert.IsNotNull( row2 );

              Assert.AreEqual(row.Address1,    row2.Address1);
              Assert.AreEqual(row.Address2,    row2.Address2);
              Assert.AreEqual(row.AddressCity, row2.AddressCity);
              Assert.AreEqual(row.AddressState, row2.AddressState);
              Assert.AreEqual(row.AddressCountry, row2.AddressCountry);
              Assert.AreEqual(row.Invoices.Length, row2.Invoices.Length);
        }