Beispiel #1
0
        public void OnPostEmailEntered()
        {
            Alert = "Email Send";
            string      UserEmail = Request.Form["EmailEntered1"].ToString().ToLower();
            Participant p         = FestivalManager.GetParticipants().Find(p => p.Email == UserEmail);

            if (p != null)
            {
                AuthorizationManager.SendEmail(UserEmail);
            }
        }
Beispiel #2
0
        public void AddParticipant_AddsOneParticipant()
        {
            //Arrange
            var mock = new Mock <IDataAccess>();

            mock.Setup(D => D.Retrieve <Participant>()).Returns(new List <Participant>());
            FestivalManager festivalManager = new FestivalManager(mock.Object);
            Participant     p1       = new Participant(new Ticket("1"), mock.Object);
            int             expected = 1;

            //Act
            festivalManager.AddParticipant(p1);
            int result = festivalManager.GetParticipants().Count;

            //Assert
            Assert.Equal(expected, result);
        }
        public void OnGet(int bookingID = -1)
        {
            Id = bookingID;
            var claimTicketID = HttpContext.User.Claims.Where(c => c.Type == "TicketID").Select(t => t.Value).FirstOrDefault();
            var bookings      = FestivalManager.GetParticipants().Where(p => p.Ticket?.TicketNumber == claimTicketID).FirstOrDefault()?.GetParticipantBookings(FestivalManager);

            if (bookings != null)
            {
                var booking = bookings.Find(b => b.ID == bookingID);
                if (booking == null || booking.State == Booking.BookingState.INACTIVE)
                {
                    Concert     = null;
                    Participant = null;
                }
                else
                {
                    Participant = FestivalManager.GetParticipant(booking.Participant.ID);
                    Concert     = FestivalManager.Calendar.GetConcert(booking.Concert.ID);
                    booking.Disable();
                }
            }
        }
Beispiel #4
0
        public void GetParticipants_ReturnsTheCorrectNumberOfParticipants()
        {
            //Arrange
            var mock = new Mock <IDataAccess>();

            mock.Setup(D => D.Retrieve <Participant>()).Returns(new List <Participant>()
            {
                new Participant(new Ticket("1"), mock.Object),
                new Participant(new Ticket("1"), mock.Object),
                new Participant(new Ticket("1"), mock.Object),
                new Participant(new Ticket("1"), mock.Object)
            });
            int expected = 4;

            FestivalManager festivalManager = new FestivalManager(mock.Object);

            //Act
            int result = festivalManager.GetParticipants().Count;

            //Assert
            Assert.Equal(expected, result);
        }
 public void OnGet()
 {
     Participants = FestivalManager.GetParticipants();
 }