public void CheckAdd() { HighscoreEntry he = new HighscoreEntry(); he.Credentials = "Username1"; he.Score = 10; List <HighscoreEntry> entries = da.AddHighscore(he).Result; Assert.Single(entries); Assert.Equal(he, entries.FirstOrDefault()); Assert.Equal(0, entries.IndexOf(he)); hc.Highscores.RemoveRange(hc.Highscores.ToList()); hc.SaveChanges(); }
public ActionResult <Highscore> Index(Highscore highscore) { using (var db = new HighscoreContext()) { db.Highscores.Add(highscore); db.SaveChanges(); } return(highscore); }