Esempio n. 1
0
        public void EditShouldEditNameVersionDescriptionOfMod()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(databaseName: "EditShouldEditNameVersionDescriptionOfMod_DB")
                          .Options;

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

            var mod = new Mod
            {
                Name        = "FlairDante",
                Version     = "1.1",
                Description = "Purple Dante",
            };

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

            string newName        = "FlairDanteV2";
            string newVersion     = "2.0";
            string newDescription = "Longer Hair";

            modService.Edit(mod.Id, newName, newVersion, newDescription);

            Assert.Equal(newName, mod.Name);
            Assert.Equal(newVersion, mod.Version);
            Assert.Equal(newDescription, mod.Description);
        }