public void TestAdd() { using (var repo = new SpelRepository(new DatabaseContext(_options))) { repo.Insert(new Spel() { SpelId = 1, SpelerIds = new List <Speler> { new Speler() { SpelerId = 1 }, new Speler() { SpelerId = 2 }, new Speler() { SpelerId = 3 } }, SpelNaam = "lala" }); } using (var repo = new SpelRepository(new DatabaseContext(_options))) { Assert.AreEqual(1, repo.Count()); } }
public async Task GetSpel_ErrorsOnNonExisting() { var repo = new SpelRepository(); var controller = new GameController(repo); var result = await controller.GetSpel("doesnt-exist") as NotFoundResult; Assert.NotNull(result); Assert.AreEqual(StatusCodes.Status404NotFound, result.StatusCode); }
public async Task GetSpel_ReturnsExisting() { var repo = new SpelRepository(); var controller = new GameController(repo); var result = await controller.GetSpel("test") as OkObjectResult; Assert.NotNull(result); Assert.NotNull(result.Value); Assert.AreEqual("test", ((Game)result.Value).Token); }
public async Task NieuwSpel_AddsToRepo() { var repo = new SpelRepository(); var controller = new GameController(repo); var result = await controller.NieuwSpel(new NewGame() { Description = "omschrijving", PlayerToken = "token" }) as OkResult; Assert.AreEqual(200, result.StatusCode); Assert.AreEqual(4, repo.Spellen.Count); }