public void GetFollowing_FollowingForDifferentFollower_ShouldNotBeReturned() { var following = new Following { FollowerId = "1", FolloweeId = "2" }; _mockFollowings.SetSource(new[] { following }); var followingFromRepository = _repository.GetFollowing("3", "2"); followingFromRepository.Should().BeNull(); }
public ActionResult Details(int id) { var gig = _context.Gigs .Include(g => g.Artist) .Include(g => g.Genre) .SingleOrDefault(g => g.Id == id); if (gig == null) { return(HttpNotFound()); } var viewModel = new GigDetailsViewModel() { Gig = gig }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); viewModel.IsAttending = _attendanceRepository.GetAttendances(gig.Id, userId) != null; viewModel.IsFollowing = _followingRepository.GetFollowing(gig.ArtistId, userId) != null; } return(View("Details", viewModel)); }
public void GetFollowing_XXX_XXX() { string userId = "1"; string followId = "1"; var follow = new Following { FollowerId = userId, FolloweeId = followId }; mockFollowing.SetSource(new[] { follow }); var followReturn = _followingRepository.GetFollowing(userId + "2", followId); followReturn.Should().Be(follow); }
public ActionResult Details(int id) { DetailsViewModel viewModel = new DetailsViewModel(); viewModel.Gig = gigRepository.GetGigWithArtistAndGenre(id); if (User.Identity.IsAuthenticated) { string userId = User.Identity.GetUserId(); viewModel.Attendance = attendanceRepository.GetAttendance(userId, id) != null; viewModel.Following = followingRepository.GetFollowing(userId, viewModel.Gig.ArtistId) != null; } else { viewModel.Attendance = false; viewModel.Following = false; } return(View(viewModel)); }
public ActionResult Details(string id) { var mahfil = _mahfilMepository.GetMahfil(id); if (mahfil == null) { return(HttpNotFound()); } var viewModel = new MahfilDetailsViewModel() { Congregration = mahfil }; if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); viewModel.IsAttending = _attendanceRepository.GetAttendance(mahfil.Id, userId) != null; viewModel.IsFollowing = _followingRepository.GetFollowing(userId, mahfil.SpeakerId) != null; } return(View("Details", viewModel)); }