示例#1
0
        public void ViewUpShouldIncreaseTheViewsOfMod()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "ViewUpShouldIncreaseTheViewsOfMod_DB")
                          .Options;

            var dbContext = new ApplicationDbContext(options);

            var modService = new ModService(dbContext);

            var mod = new Mod
            {
                Views = 10,
            };

            dbContext.Mods.Add(mod);
            dbContext.SaveChanges();

            modService.ViewUp(mod.Id);

            Assert.Equal(11, mod.Views);
        }