コード例 #1
0
ファイル: BaseDBFuentTest.cs プロジェクト: schotime/NPoco
        protected virtual void InsertData()
        {
            InMemoryUsers = new List<User>();
            InMemoryExtraUserInfos = new List<ExtraUserInfo>();
            InMemoryHouses = new List<House>();

            for (var i = 0; i < 5; i++)
            {
                var house = new House()
                {
                    Address = i + " Road Street, Suburb"
                };
                Database.Insert(house);
                InMemoryHouses.Add(house);
            }

            Database.Insert(new House
                {
                    Address = "_ Road\\Street, Suburb"
                }
            );

            for (var i = 0; i < 15; i++)
            {
                var user = new User
                {
                    Name = "Name" + (i + 1),
                    Age = 20 + (i + 1),
                    DateOfBirth = new DateTime(1970, 1, 1).AddYears(i - 1),
                    Savings = 50.00m + (1.01m * (i + 1)),
                    IsMale = (i % 2 == 0),
                    YorN = (i % 2 == 0) ? 'Y' : 'N',
                    UniqueId = (i % 2 != 0 ? Guid.NewGuid() : (Guid?)null),
                    TimeSpan = new TimeSpan(1, 1, 1),
                    House = i % 2 == 0 ? null : InMemoryHouses[i % 5],
                    SupervisorId = (i + 1) % 2 == 0 ? (i + 1) : (int?)null,
                    Address = i % 10 == 0 ? null : new Address()
                    {
                        Street = i + " Road Street",
                        City = "City " + i
                    },
                    TestEnum = (i + 1) % 2 == 0 ? TestEnum.All : TestEnum.None
                };
                Database.Insert(user);
                InMemoryUsers.Add(user);

                var extra = new ExtraUserInfo
                {
                    UserId = user.UserId,
                    Email = "email" + (i + 1) + "@email.com",
                    Children = (i + 1)
                };
                Database.Insert(extra);
                InMemoryExtraUserInfos.Add(extra);

                var one = new One()
                {
                    Name = "Name" + (i + 1),
                };
                Database.Insert(one);

                for (int j = 0; j < (i % 3); j++)
                {
                    var many = new Many()
                    {
                        OneId = one.OneId,
                        Currency = "Cur" + (i + j + 1),
                        Value = (i + j + 1)
                    };
                    Database.Insert(many);
                }
            }
        }
コード例 #2
0
ファイル: BaseDBFuentTest.cs プロジェクト: schotime/NPoco
 protected void AssertExtraUserInfo(ExtraUserInfo extraUserInfo, ExtraUserInfo actualUserInfo)
 {
     Assert.AreEqual(extraUserInfo.UserId, actualUserInfo.UserId);
     Assert.AreEqual(extraUserInfo.Email, actualUserInfo.Email);
 }
コード例 #3
0
ファイル: BaseDBFuentTest.cs プロジェクト: philnolan/NPoco
        protected void InsertData()
        {
            InMemoryUsers = new List<User>();
            InMemoryExtraUserInfos = new List<ExtraUserInfo>();
            for (var i = 0; i < 15; i++)
            {
                var user = new User
                {
                    Name = "Name" + (i + 1),
                    Age = 20 + (i + 1),
                    DateOfBirth = new DateTime(1970, 1, 1).AddYears(i + 1),
                    Savings = 50.00m + (1.01m * (i + 1)),
                    IsMale = (i%2 == 0)
                };
                Database.Insert(user);
                InMemoryUsers.Add(user);

                var extra = new ExtraUserInfo
                {
                    UserId = user.UserId,
                    Email = "email" + (i + 1) + "@email.com",
                    Children = (i + 1)
                };
                Database.Insert(extra);
                InMemoryExtraUserInfos.Add(extra);
            }
        }
コード例 #4
0
ファイル: BaseDBFuentTest.cs プロジェクト: payoff/NPoco
        protected virtual void InsertData()
        {
            InMemoryUsers = new List<User>();
            InMemoryExtraUserInfos = new List<ExtraUserInfo>();
            InMemoryHouses = new List<House>();

            for (var i = 0; i < 5; i++)
            {
                var house = new House()
                {
                    Address = i + " Road Street, Suburb"
                };
                Database.Insert(house);
                InMemoryHouses.Add(house);
            }

            for (var i = 0; i < 15; i++)
            {
                var user = new User
                {
                    Name = "Name" + (i + 1),
                    Age = 20 + (i + 1),
                    DateOfBirth = new DateTime(1970, 1, 1).AddYears(i - 1),
                    Savings = 50.00m + (1.01m * (i + 1)),
                    IsMale = (i%2 == 0),
                    YorN = (i%2 == 0) ? 'Y' : 'N',
                    UniqueId = (i%2 != 0 ? Guid.NewGuid() : (Guid?)null),
                    TimeSpan = new TimeSpan(1,1,1),
                    HouseId = i%2==0?(int?)null:InMemoryHouses[i%5].HouseId,
                    SupervisorId = (i+1)%2==0?(i+1):(int?)null
                };
                Database.Insert(user);
                InMemoryUsers.Add(user);

                var extra = new ExtraUserInfo
                {
                    UserId = user.UserId,
                    Email = "email" + (i + 1) + "@email.com",
                    Children = (i + 1)
                };
                Database.Insert(extra);
                InMemoryExtraUserInfos.Add(extra);
            }
        }
コード例 #5
0
ファイル: BaseDBFluentTest.cs プロジェクト: xf599/NPoco
 protected void AssertExtraUserInfo(ExtraUserInfo extraUserInfo, ExtraUserInfo actualUserInfo)
 {
     Assert.AreEqual(extraUserInfo.UserId, actualUserInfo.UserId);
     Assert.AreEqual(extraUserInfo.Email, actualUserInfo.Email);
 }
コード例 #6
0
ファイル: BaseDBFluentTest.cs プロジェクト: xf599/NPoco
        protected virtual void InsertData()
        {
            InMemoryUsers          = new List <User>();
            InMemoryExtraUserInfos = new List <ExtraUserInfo>();
            InMemoryHouses         = new List <House>();

            for (var i = 0; i < 5; i++)
            {
                var house = new House()
                {
                    Address = i + " Road Street, Suburb"
                };
                Database.Insert(house);
                InMemoryHouses.Add(house);
            }

            Database.Insert(new House
            {
                Address = "_ Road\\Street, Suburb"
            }
                            );

            for (var i = 0; i < 15; i++)
            {
                var user = new User
                {
                    Name         = "Name" + (i + 1),
                    Age          = 20 + (i + 1),
                    DateOfBirth  = new DateTime(1970, 1, 1).AddYears(i - 1),
                    Savings      = 50.00m + (1.01m * (i + 1)),
                    IsMale       = (i % 2 == 0),
                    YorN         = (i % 2 == 0) ? 'Y' : 'N',
                    UniqueId     = (i % 2 != 0 ? Guid.NewGuid() : (Guid?)null),
                    TimeSpan     = new TimeSpan(1, 1, 1),
                    House        = i % 2 == 0 ? null : InMemoryHouses[i % 5],
                    SupervisorId = (i + 1) % 2 == 0 ? (i + 1) : (int?)null,
                    Address      = i % 10 == 0 ? null : new Address()
                    {
                        Street = i + " Road Street",
                        City   = "City " + i
                    },
                    TestEnum = (i + 1) % 2 == 0 ? TestEnum.All : TestEnum.None
                };
                Database.Insert(user);
                InMemoryUsers.Add(user);

                var extra = new ExtraUserInfo
                {
                    UserId   = user.UserId,
                    Email    = "email" + (i + 1) + "@email.com",
                    Children = (i + 1)
                };
                Database.Insert(extra);
                InMemoryExtraUserInfos.Add(extra);

                var one = new One()
                {
                    Name = "Name" + (i + 1),
                };
                Database.Insert(one);

                for (int j = 0; j < (i % 3); j++)
                {
                    var many = new Many()
                    {
                        OneId    = one.OneId,
                        Currency = "Cur" + (i + j + 1),
                        Value    = (i + j + 1)
                    };
                    Database.Insert(many);
                }
            }
        }