public HttpResponseMessage Delete(int id) { try { TournamentRepository rep = new TournamentRepository(); Tournament t = rep.GetByID(id); rep.Delete(t); return(Request.CreateResponse(HttpStatusCode.OK, "")); } catch (Exception e) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, e.Message)); } }
public void DeleteTournamentTest() { // Arrange HollywoodTestEntities dataContext = new HollywoodTestEntities(); TournamentRepository tournamentRepository = new TournamentRepository(dataContext); Tournament tournament = new Tournament() { TournamentName = "Delete Tournament Data Access Unit Test", }; // Act int tournamentID = tournamentRepository.Create(tournament); bool isDeleted = tournamentRepository.Delete(tournamentID); // Assert Assert.IsTrue(isDeleted); }