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

            var dbContext = new ApplicationDbContext(options);

            var modService = new ModService(dbContext);

            var mod = new Mod
            {
                Name = "DevilSwordNero",
            };

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

            var test = modService.GetById(mod.Id);

            Assert.Equal(mod.Name, test.Name);
        }