示例#1
0
        /// <summary>
        /// Constructor for unit testing.
        /// </summary>
        /// <param name="achievementService">The achievement service.</param>
        /// <param name="userService">The user service.</param>
        /// <param name="publisher">The publisher.</param>
        /// <param name="log">The log.</param>
        public AutoUpdateManager(IAchievementService achievementService, IUserService userService,
                                 IFacebookClientService publisher, IAutoUpdateLogger log)
        {
            if (achievementService == null)
            {
                throw new ArgumentNullException("achievementService");
            }

            if (userService == null)
            {
                throw new ArgumentNullException("userService");
            }

            if (publisher == null)
            {
                throw new ArgumentNullException("publisher");
            }

            if (log == null)
            {
                throw new ArgumentNullException("log");
            }

            _achievementService = achievementService;
            _userService        = userService;
            _publisher          = publisher;
            _log = log;
        }
        /// <summary>
        /// Prepares the log.
        /// </summary>
        /// <param name="publisher">The publisher.</param>
        private static void PrepareLog(Publisher publisher)
        {
            IAutoUpdateLogger autoUpdateLogger = publisher.Logger;

            // only keeps logs for the past 10 days
            autoUpdateLogger.Delete(DateTime.Now.AddDays(-10));
            // the default writer saves output to a file, this will display it in the console as well
            autoUpdateLogger.Attach(Console.Out);
        }
        public void SetUp()
        {
            _achievementServiceMock = new Mock <IAchievementService>();
            _userServiceMock        = new Mock <IUserService>();
            _loggerMock             = new Mock <IAutoUpdateLogger>();
            _publisherMock          = new Mock <IFacebookPublisher>();

            IAchievementService achievementService = _achievementServiceMock.Object;
            IUserService        userService        = _userServiceMock.Object;
            IAutoUpdateLogger   logger             = _loggerMock.Object;
            IFacebookPublisher  publisher          = _publisherMock.Object;

            _manager = new AutoUpdateManager(achievementService, userService, publisher, logger);
        }
示例#4
0
        public void SetUp()
        {
            _achievementServiceMock = new DynamicMock(typeof(IAchievementService));
            _userServiceMock        = new DynamicMock(typeof(IUserService));
            _loggerMock             = new DynamicMock(typeof(IAutoUpdateLogger));
            _publisherMock          = new DynamicMock(typeof(IFacebookPublisher));

            IAchievementService achievementService = (IAchievementService)_achievementServiceMock.MockInstance;
            IUserService        userService        = (IUserService)_userServiceMock.MockInstance;
            IAutoUpdateLogger   logger             = (IAutoUpdateLogger)_loggerMock.MockInstance;
            IFacebookPublisher  publisher          = (IFacebookPublisher)_publisherMock.MockInstance;

            _manager = new AutoUpdateManager(achievementService, userService, publisher, logger);
        }
示例#5
0
 public AdminController(IAutoUpdateManager manager, IAutoUpdateLogger log)
 {
     _manager = manager;
     _log     = log;
 }