public void TestInit()
        {
            listOfReports = new List <EndOfDayReport>
            {
                new EndOfDayReport {
                    Id = 1, TotalDistance = 100, TotalDuration = 60, TotalSteps = 5, UserId = "yolo"
                },
                new EndOfDayReport {
                    Id = 2, TotalDistance = 200, TotalDuration = 70, TotalSteps = 10, UserId = "swag"
                },
                new EndOfDayReport {
                    Id = 3, TotalDistance = 300, TotalDuration = 80, TotalSteps = 15, UserId = "gg"
                },
                new EndOfDayReport {
                    Id = 4, TotalDistance = 400, TotalDuration = 90, TotalSteps = 20, UserId = "nore"
                }
            };



            var mockContext = new Mock <ApplicationDbContext>();
            var eodRepo     = new Mock <IEndOfDayReportRepository>();

            eodRepo.Setup(g => g.ReadAll()).Returns(listOfReports);
            eodRepo.Setup(g => g.GetById(It.IsAny <long>()))
            .Returns <long>(i => Task.FromResult(listOfReports.Where(x => x.Id.Equals(i)).Single()));
            eodRepo.Setup(g => g.GetByUser(It.IsAny <String>()))
            .Returns <String>(i => listOfReports.Where(x => x.UserId == i).ToList());
            var activityRepo     = new Mock <IActivityRepository>();
            var userRepo         = new Mock <IUserRepository>();
            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>();
            var goalRepo         = new Mock <IGoalRepository>();
            var userBadgeService = new Mock <IUserBadgeService>();

            IFeedEventService  feedService       = new FeedEventService(feedEventRepo.Object, membershipRepo.Object, moodRepo.Object, groupRepo.Object, badgeRepo.Object, unitOfWork.Object);
            IMembershipService membershipService = new MembershipService(membershipRepo.Object, feedService, userBadgeService.Object, unitOfWork.Object);
            IUserService       userService       = new UserService(userRepo.Object, membershipService, unitOfWork.Object);
            IGoalService       goalService       = new GoalService(goalRepo.Object, activityRepo.Object, feedService, unitOfWork.Object);

            eodService = new EndOfDayReportService(eodRepo.Object, feedService, goalService, userService, activityRepo.Object, unitOfWork.Object);
        }
Exemplo n.º 2
0
 public MEndOfDayReportController(IEndOfDayReportService endOfDayReportService)
 {
     _endOfDayReportService = endOfDayReportService;
 }
Exemplo n.º 3
0
 public ChartController(IActivityService activityService, IEndOfDayReportService endOfDayReportService, IUserService userService)
 {
     _activityService       = activityService;
     _endOfDayReportService = endOfDayReportService;
     _userService           = userService;
 }