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

            var dbContext = new ApplicationDbContext(options);

            var modService = new ModService(dbContext);

            string imageUrl = "qweqwe";

            var mod = new Mod
            {
                MainPicturePath = "asdasd",
            };

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

            modService.AddImageUrl(mod.Id, imageUrl);

            Assert.Equal(imageUrl, mod.MainPicturePath);
        }