Exemple #1
0
        public void GetGigsUserAttending_GigIsInThePast_ShouldNotBeReturned()
        {
            var gig = new Gig()
            {
                DateTime = DateTime.Now.AddDays(-1)
            };
            var attendance = new Attendance {
                Gig = gig, AttendeeId = "1"
            };

            _mockAttendances.SetSource(new[] { attendance });

            var gigs = _repository.GetGigsUserAttending(attendance.AttendeeId);

            gigs.Should().BeEmpty();
        }
Exemple #2
0
        public void GetGigsUserAttending_ThereIsNotAnyAttendance_ShoulNotBeReturned()
        {
            var attendance = new Attendance
            {
                AttendeeId = _userId + "-",
                Gig        = new Gig()
                {
                    ArtistId = "2",
                }
            };

            _mockAttendance.SetSource(new [] { attendance });

            var gigs = _repository.GetGigsUserAttending(_userId);

            gigs.Should().BeEmpty();
        }
        public void GetGigsUserAttending_AttendenceForADifferentUser_ShouldNotBeReturned()
        {
            Gig gig = new Gig()
            {
                Datetime = DateTime.Now.AddDays(1)
            };
            Attendence attendence = new Attendence()
            {
                Gig = gig, AttendeeId = "1"
            };

            _mockAttendence.SetSource(new[] { attendence });

            var gigs = _repository.GetGigsUserAttending("-");

            gigs.Should().BeEmpty();
        }
Exemple #4
0
        public ActionResult Attending()
        {
            string userId = User.Identity.GetUserId();

            GigsViewModel model = new GigsViewModel();

            model.UpcomingGigs = gigRepository.GetGigsUserAttending(userId);
            model.ShowActions  = User.Identity.IsAuthenticated;
            model.Heading      = "Gigs I'm Attending";
            model.Attendances  = attendanceRepository.GetFutureAttendances(userId).ToLookup(x => x.GigId);
            return(View("Gigs", model));
        }
        public void GetGigsUserAttending_GigIsFromDifferentArtist_ShouldNotBeReturned()
        {
            // Arrange
            var gig = new Gig()
            {
                DateTime = DateTime.Now.AddDays(1)
            };
            var attendance = new Attendance()
            {
                Gig = gig, AttendeeId = "1"
            };

            _mockAttendances.SetSource(new List <Attendance> {
                attendance
            });

            // Act
            var attendances = _repository.GetGigsUserAttending(attendance.AttendeeId + "-");

            // Assert
            attendances.Should().BeEmpty();
        }
        public ActionResult Attending()
        {
            var userId = User.Identity.GetUserId();

            var viewModel = new GigsViewModel()
            {
                UpcomingGigs = _gigRepository.GetGigsUserAttending(userId),
                ShowActions  = User.Identity.IsAuthenticated,
                Heading      = "Gigs I'm Attending",
                Attendances  = _attendanceRepository.GetFutureAttendances(userId).ToLookup(a => a.GigId)
            };

            return(View("Gigs", viewModel));
        }
Exemple #7
0
        public void GetGigsUserAttending_NoGigsForTheUser_ShouldNotReturn()
        {
            //arrange
            var gig = new Gig {
                DateTime = DateTime.Today.AddDays(1), ArtistId = "1"
            };

            _mockGigs.SetSource(new [] { gig });

            var attendance = new Attendance {
                Gig = gig, AttendeeId = "2"
            };

            _mockAttendance.SetSource(new [] { attendance });
            //act
            var gigs = _repository.GetGigsUserAttending(gig.ArtistId);

            //assert
            gigs.Should().BeEmpty();            //why _repo.Attendances is empty ? - wrong mocking
        }