Beispiel #1
0
        public void IncrementViewsShouldIncreaseCounterOnViews()
        {
            var options   = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase("Database_For_Tests").Options;
            var dbContext = new ApplicationDbContext(options);
            var service   = new EducationService(dbContext);

            dbContext.Educations.Add(new Education());
            dbContext.SaveChanges();

            var education = dbContext.Educations.First();

            service.IncrementViews(education);
            service.IncrementViews(education);

            Assert.Equal(2, education.Views);
        }