예제 #1
0
        public void UpdateEventTest()
        {
            // Arrange
            HollywoodTestEntities dataContext     = new HollywoodTestEntities();
            EventRepository       eventRepository = new EventRepository(dataContext);
            Event _event = new Event()
            {
                TournamentID     = 1,
                EventName        = "Update Event Data Access Unit Test",
                EventNumber      = 1,
                EventDateTime    = Convert.ToDateTime("2019-04-16"),
                EventEndDateTime = Convert.ToDateTime("2019-06-16"),
                AutoClose        = true,
            };

            // Act
            int eventId = eventRepository.Create(_event);

            _event.EventID   = eventId;
            _event.EventName = "Updated Event Data Access Unit Test";
            bool isUpdated = eventRepository.Update(_event);

            // Assert
            Assert.IsTrue(isUpdated);
        }
예제 #2
0
        public void UpdateEventDetailTest()
        {
            // Arrange
            HollywoodTestEntities dataContext           = new HollywoodTestEntities();
            EventDetailRepository eventDetailRepository = new EventDetailRepository(dataContext);
            EventDetail           eventDetail           = new EventDetail()
            {
                EventID             = 1,
                EventDetailStatusID = 1,
                EventDetailName     = "Update Event Detail Data Access Unit Test",
                EventDetailNumber   = 1,
                EventDetailsOdd     = 1,
                FinishingPosition   = 1,
                FirstTimer          = true,
            };

            // Act
            int EventDetailID = eventDetailRepository.Create(eventDetail);

            eventDetail.EventDetailID   = EventDetailID;
            eventDetail.EventDetailName = "Updated Event Detail Data Access Unit Test";
            bool isUpdated = eventDetailRepository.Update(eventDetail);

            // Assert
            Assert.IsTrue(isUpdated);
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the event detail repository class.
        /// </summary>
        /// <param name="db">The database.</param>
        public TournamentRepository()
        {
            HollywoodTestEntities hollywoodTestEntities = new HollywoodTestEntities();

            _dataAccessTournamentRepository = new HollywoodTest.DataAccess.Repository.TournamentRepository(hollywoodTestEntities);
            _eventRepository = new EventRepository();
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the event detail repository class.
        /// </summary>
        /// <param name="db">The database.</param>
        public EventRepository()
        {
            HollywoodTestEntities hollywoodTestEntities = new HollywoodTestEntities();

            _dataAccessEventRepository = new DataAccess.Repository.EventRepository(hollywoodTestEntities);
            _eventDetailRepository     = new EventDetailRepository();
        }
예제 #5
0
        public void GetByEventIDTest()
        {
            // Arrange
            HollywoodTestEntities dataContext           = new HollywoodTestEntities();
            EventDetailRepository eventDetailRepository = new EventDetailRepository(dataContext);

            // Act
            var tournaments = eventDetailRepository.GetByEventID(1);

            // Assert
            Assert.AreNotEqual(tournaments.Count(), 0);
        }
예제 #6
0
        public void GetAllTournamentsTest()
        {
            // Arrange
            HollywoodTestEntities dataContext          = new HollywoodTestEntities();
            TournamentRepository  tournamentRepository = new TournamentRepository(dataContext);

            // Act
            var tournaments = tournamentRepository.GetAll();

            // Assert
            Assert.AreNotEqual(tournaments.Count(), 0);
        }
예제 #7
0
        public void CreateTournamentTest()
        {
            // Arrange
            HollywoodTestEntities dataContext          = new HollywoodTestEntities();
            TournamentRepository  tournamentRepository = new TournamentRepository(dataContext);
            Tournament            tournament           = new Tournament()
            {
                TournamentName = "Create Tournament Data Access Unit Test",
            };

            // Act
            int tournamentID = tournamentRepository.Create(tournament);

            // Assert
            Assert.AreNotEqual(tournamentID, 0);
        }
예제 #8
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);
        }
예제 #9
0
        public void CreateEventTest()
        {
            // Arrange
            HollywoodTestEntities dataContext     = new HollywoodTestEntities();
            EventRepository       eventRepository = new EventRepository(dataContext);
            Event _event = new Event()
            {
                TournamentID     = 1,
                EventName        = "Create Event Data Access Unit Test",
                EventNumber      = 1,
                EventDateTime    = Convert.ToDateTime("2019-04-16"),
                EventEndDateTime = Convert.ToDateTime("2019-06-16"),
                AutoClose        = true,
            };

            // Act
            int eventId = eventRepository.Create(_event);

            // Assert
            Assert.AreNotEqual(eventId, 0);
        }
예제 #10
0
        public void CreateEventDetailTest()
        {
            // Arrange
            HollywoodTestEntities dataContext           = new HollywoodTestEntities();
            EventDetailRepository eventDetailRepository = new EventDetailRepository(dataContext);
            EventDetail           eventDetail           = new EventDetail()
            {
                EventID             = 1,
                EventDetailStatusID = 1,
                EventDetailName     = "Create Event Detail Data Access Unit Test",
                EventDetailNumber   = 1,
                EventDetailsOdd     = 1,
                FinishingPosition   = 1,
                FirstTimer          = true,
            };

            // Act
            int EventDetailID = eventDetailRepository.Create(eventDetail);

            // Assert
            Assert.AreNotEqual(EventDetailID, 0);
        }
예제 #11
0
 /// <summary>
 /// Initializes a new instance of the event repository class.
 /// </summary>
 /// <param name="db">The database.</param>
 public EventRepository(HollywoodTestEntities db)
 {
     _db = db;
 }
예제 #12
0
        /// <summary>
        /// Initializes a new instance of the event detail repository class.
        /// </summary>
        /// <param name="db">The database.</param>
        public ErrorLogRepository()
        {
            HollywoodTestEntities hollywoodTestEntities = new HollywoodTestEntities();

            _dataAccessErrorLogRepository = new DataAccess.Repository.ErrorLogRepository(hollywoodTestEntities);
        }
예제 #13
0
 /// <summary>
 /// Initializes a new instance of the event detail repository class.
 /// </summary>
 /// <param name="db">The database.</param>
 public TournamentRepository(HollywoodTestEntities db)
 {
     _db = db;
 }
 /// <summary>
 /// Initializes a new instance of the event detail repository class.
 /// </summary>
 /// <param name="db">The database.</param>
 public ErrorLogRepository(HollywoodTestEntities db)
 {
     _db = db;
 }