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

            var dbContext = new ApplicationDbContext(options);

            var modService = new ModService(dbContext);

            var mod = new Mod
            {
                TotalDownloadCount = 100,
            };
            var game = new Game
            {
                TotalDownloadCount = 56
            };

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

            modService.DownloadsCountUp(mod.Id, game.Id);

            Assert.Equal(101, mod.TotalDownloadCount);
            Assert.Equal(57, game.TotalDownloadCount);
        }