Esempio n. 1
0
        public SqueakesRepositoryTests()
        {
            var dbContextOptions = new DbContextOptionsBuilder <SqueakerContext>()
                                   .UseSqlite("Filename=:memory:")
                                   .Options;

            this.dbContext = new SqueakerContext(dbContextOptions);
            this.dbContext.Database.OpenConnection();

            this.dbContext.Database.EnsureDeleted();
            this.dbContext.Database.EnsureCreated();

            this.sut = new SqueakesRepository(this.dbContext);
        }
Esempio n. 2
0
 private void SeedData(SqueakerContext dbContext)
 {
     dbContext.Squeakes.RemoveRange(dbContext.Squeakes);
     dbContext.SaveChanges();
     dbContext.Squeakes.AddRange(new[]
     {
         new Squeake
         {
             Id   = "39700594",
             Text = "Cum sociis natoque penatibus et"
         },
         new Squeake
         {
             Id   = "ea90b094",
             Text = "Nam a sapien"
         },
         new Squeake
         {
             Id   = "1028bde8",
             Text = "Praesent augue Sed bibendum."
         }
     });
     dbContext.SaveChanges();
 }