public void CreatingModShouldIncreaseGameModCount() { var options = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(databaseName: "CreatingModShouldIncreaseGameModCount_DB") .Options; var dbContext = new ApplicationDbContext(options); var modService = new ModService(dbContext); var game = new Game { ModCount = 0, }; var user = new ApplicationUser { ModCount = 0, }; dbContext.Users.Add(user); dbContext.Games.Add(game); dbContext.SaveChanges(); var mod = new Mod { Game = game, User = user, }; modService.Create(mod); Assert.Equal(1, mod.Game.ModCount); }