コード例 #1
0
 public void TearDown()
 {
     using (var context = new MemeGeneratorDbContext(_options))
     {
         context.MemeImages.RemoveRange(context.MemeImages);
         context.SaveChanges();
     }
 }
コード例 #2
0
        public void Count_MemeImages_ReturnCountMemeImages()
        {
            using (var context = new MemeGeneratorDbContext(_options))
            {
                var repository = new MemeRepository(context);
                context.MemeImages.Add(new MemeImage());
                context.SaveChanges();

                var countMemeImages = repository.Count();

                countMemeImages.Should().Be(context.MemeImages.Count());
            }
        }
コード例 #3
0
        public void Insert_MemeImage_InsertImageIntoDb()
        {
            const string fakeName = "name";

            using (var context = new MemeGeneratorDbContext(_options))
            {
                var repository = new MemeRepository(context);

                repository.Insert(new MemeImage {
                    Name = fakeName
                });
                context.SaveChanges();

                context.MemeImages.Single().Name.Should().Be(fakeName);
            }
        }
コード例 #4
0
 public void Save()
 {
     _context.SaveChanges();
 }