コード例 #1
0
ファイル: UserContext.cs プロジェクト: jpdykstra/user-portal
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            List <User> users = UserSeedLogic.Instance.PopulateUserList(200).ToList();

            modelBuilder.Entity <User>().HasData(users);

            foreach (var user in users)
            {
                modelBuilder.Entity <Interest>().HasData(InterestSeedLogic.Instance.PopulateInterestList(user, RandomHelper.GetRandomShort(1, 6)));
                modelBuilder.Entity <Address>().HasData(AddressSeedFactory.Create(AddressType.Mailing).Populate(user));
                modelBuilder.Entity <Address>().HasData(AddressSeedFactory.Create(AddressType.Billing).Populate(user));
            }
        }
コード例 #2
0
        public void SeedLogic_Should_ReturnBillingAddress_Class()
        {
            IAddressSeed addressLogic = AddressSeedFactory.Create(AddressType.Billing);

            Assert.IsInstanceOfType(addressLogic, typeof(BillingAddressSeedLogic));
        }