Пример #1
0
        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));
            }
        }
Пример #2
0
        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);
        }