public void TestInit() { _userMoodList = new List <UserMood> { new UserMood { Id = 0, MoodId = 0, UserId = "user-123" }, new UserMood { Id = 1, MoodId = 1, UserId = "user-123" }, new UserMood { Id = 2, MoodId = 2, UserId = "user-456" } }; var mockContext = new Mock <ApplicationDbContext>(); var userMoodRepo = new Mock <IUserMoodRepository>(); userMoodRepo.Setup(u => u.ReadAll()).Returns(_userMoodList); userMoodRepo.Setup(u => u.GetById(It.IsAny <long>())) .Returns <long>(i => Task.FromResult(_userMoodList.Where(x => x.Id == i).Single())); userMoodRepo.Setup(u => u.GetByUser(It.IsAny <string>())) .Returns <string>(i => _userMoodList.Where(x => x.UserId == i).ToList()); var groupRepo = new Mock <IGroupRepository>(); var feedEventRepo = new Mock <IFeedEventRepository>(); var membershipRepo = new Mock <IMembershipRepository>(); var moodRepo = new Mock <IMoodRepository>(); var badgeRepo = new Mock <IBadgeRepository>(); var unitOfWork = new Mock <IUnitOfWork>(); IFeedEventService feedService = new FeedEventService(feedEventRepo.Object, membershipRepo.Object, moodRepo.Object, groupRepo.Object, badgeRepo.Object, unitOfWork.Object); _userMoodService = new UserMoodService(userMoodRepo.Object, feedService, unitOfWork.Object); }
public MUserMoodController(IUserMoodService userMoodService) { _userMoodService = userMoodService; }