public void TearDown() { using (var context = new MemeGeneratorDbContext(_options)) { context.MemeImages.RemoveRange(context.MemeImages); context.SaveChanges(); } }
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()); } }
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); } }
public void Save() { _context.SaveChanges(); }