Ejemplo n.º 1
0
        public void SetUp()
        {
            var fixture = new TestFixture();

            fixture.AddMappingProfile <TableMappingProfile>();

            if (UseInMemoryDb)
            {
                fixture.UseInMemoryDatabase <TableTestContext>();
            }
            else
            {
                fixture.UseDatabase <TableTestContext>();
            }

            fixture.Initialize();

            Context = fixture.GetService <TableTestContext>();

            Context.Database.EnsureDeleted();

            Context.Database.EnsureCreated();

            TableOrderTestDataInitializer.Init(Context);
        }
Ejemplo n.º 2
0
        public void SetUp()
        {
            var fixture = new TestFixture();

            fixture.AddMappingProfile <TableMappingProfile>();

            fixture.UseInMemoryDatabase <TableTestContext>();

            fixture.Initialize();

            Context = fixture.GetService <TableTestContext>();

            TableFilterTestDataInitializer.Init(Context);
        }
        public static void Init(TableTestContext context)
        {
            context.Users.AddRange(new List <User>
            {
                new User
                {
                    FirstName = "Vasia",
                    LastName  = "A",
                    Email     = "*****@*****.**",
                    IsAdmin   = true,
                    Adress    = new Adress {
                        Street = "Dunina"
                    },
                    Accounts =
                        new List <Account>
                    {
                        new Account
                        {
                            AccountNumber = 12312,
                            BankName      = "BSB"
                        }
                    }
                },

                new User
                {
                    FirstName = "Sergey",
                    LastName  = "B",
                    Email     = "*****@*****.**",
                    IsAdmin   = false,
                    Adress    = new Adress {
                        Street = "Marzinkevicha"
                    },
                    Accounts =
                        new List <Account>
                    {
                        new Account
                        {
                            AccountNumber = 142,
                            BankName      = "VTB"
                        }
                    }
                }
            });

            context.SaveChanges();
        }