コード例 #1
0
        public void GetGalleryUrlsByIdShouldReturnTheImagesOfMod()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "AddGalleryUrlsShouldAddMultipleImagesToMod_DB")
                          .Options;

            var dbContext  = new ApplicationDbContext(options);
            var modService = new ModService(dbContext);

            var urls = new List <string>();

            urls.Add("qqq");
            urls.Add("222");
            urls.Add("rrr");

            var mod = new Mod();

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

            modService.AddGalleryUrls(mod.Id, urls);

            var gallery = modService.GetGalleryUrlsById(mod.Id);

            Assert.Equal(3, gallery.Count);
        }