public void InvokeIPartialCircleSvgPathProvider_GetSvgPathMethodAsManyTimesAsAvailableOutputPerSecondViewModels() { // Arrange var outputPerSecondViewModelDataProvider = new Mock <IOutputPerSecondViewModelDataProvider>(); var partialCircleSvgPathProvider = new Mock <IPartialCircleSvgPathProvider>(); var leaderboardViewModelFactory = new Mock <ILeaderboardViewModelFactory>(); var leaderboardService = new LeaderboardService(outputPerSecondViewModelDataProvider.Object, partialCircleSvgPathProvider.Object, leaderboardViewModelFactory.Object); var outputPerSecondViewModels = new List <OutputPerSecondViewModel>() { new OutputPerSecondViewModel(), new OutputPerSecondViewModel(), new OutputPerSecondViewModel(), new OutputPerSecondViewModel(), new OutputPerSecondViewModel(), }; outputPerSecondViewModelDataProvider.Setup(p => p.GetTopHealingOnPageInDescendingOrder(It.IsAny <int>(), It.IsAny <int>())).Returns(outputPerSecondViewModels); var pageNumber = 0; var expectedInvocationsCount = outputPerSecondViewModels.Count; // Act leaderboardService.GetTopHealingOnPage(pageNumber); // Assert partialCircleSvgPathProvider.Verify(p => p.GetSvgPath(It.IsAny <int>(), 75, 300), Times.Exactly(expectedInvocationsCount)); }
public System(CommandService commandService, ListService systemService, CooldownService cooldownService, LeaderboardService lbService) { _commandService = commandService; _systemService = systemService; _cooldownService = cooldownService; _lbService = lbService; }
private void SceneCreated(Scene scene) { var pluginName = scene.GetHostMetadata("stormancer.leaderboard"); if (!string.IsNullOrEmpty(pluginName)) { var leaderboardService = new LeaderboardService(scene); scene.DependencyResolver.RegisterComponent(leaderboardService); } }
public void CreateCorrectInstance_WhenParametersAreValid() { // Arrange var outputPerSecondViewModelDataProvider = new Mock <IOutputPerSecondViewModelDataProvider>(); var partialCircleSvgPathProvider = new Mock <IPartialCircleSvgPathProvider>(); var leaderboardViewModelFactory = new Mock <ILeaderboardViewModelFactory>(); // Act var actualInstance = new LeaderboardService(outputPerSecondViewModelDataProvider.Object, partialCircleSvgPathProvider.Object, leaderboardViewModelFactory.Object); // Assert Assert.That(actualInstance, Is.Not.Null); Assert.That(actualInstance, Is.InstanceOf <ILeaderboardService>()); }
private StatsManager() { this.userDocumentMap = new Dictionary <string, StatsValueDocument>(); this.eventList = new List <StatEvent>(); this.statTimer = new CallBufferTimer <XboxLiveUser>(TimePerCall); this.statTimer.Completed += this.TimerCompleteCallback; this.statPriorityTimer = new CallBufferTimer <XboxLiveUser>(TimePerCall); this.statPriorityTimer.Completed += this.TimerCompleteCallback; this.statsService = new StatsService(); this.leaderboardService = new LeaderboardService(); RunFlushTimer(); }
public void InvokeIOutputPerSecondViewModelDataProvider_GetTopHealingOnPageInDescendingOrderAsManyTimesAsRequestedPages(int pageNumber) { // Arrange var outputPerSecondViewModelDataProvider = new Mock <IOutputPerSecondViewModelDataProvider>(); var partialCircleSvgPathProvider = new Mock <IPartialCircleSvgPathProvider>(); var leaderboardViewModelFactory = new Mock <ILeaderboardViewModelFactory>(); var leaderboardService = new LeaderboardService(outputPerSecondViewModelDataProvider.Object, partialCircleSvgPathProvider.Object, leaderboardViewModelFactory.Object); var outputPerSecondViewModels = new List <OutputPerSecondViewModel>(); outputPerSecondViewModelDataProvider.Setup(p => p.GetTopHealingOnPageInDescendingOrder(It.IsAny <int>(), It.IsAny <int>())).Returns(outputPerSecondViewModels); // Act leaderboardService.GetTopHealingOnPage(pageNumber); // Assert outputPerSecondViewModelDataProvider.Verify(p => p.GetTopHealingOnPageInDescendingOrder(It.IsAny <int>(), It.IsAny <int>()), Times.Exactly(pageNumber + 1)); }
private async Task MessageReceivedAsync(IDialogContext context, IAwaitable <object> result) { var activity = await result as IMessageActivity; var playerName = Utils.SanitizeText(activity.Text); if (await LeaderboardService.IsNewPlayer(playerName)) { context.ConversationData.SetValue(Constants.PLAYER_NAME_KEY, playerName); await context.PostAsync($"Let's play and earn some coins!"); await context.Forward(new WhoIsDialog(), AfterWhoIsDialog, activity); } else { await context.PostAsync("This address has already been used."); context.Wait(MessageReceivedAsync); } }
private async Task AfterWhoIsDialog(IDialogContext context, IAwaitable <double> result) { var score = await result; var playerName = context.ConversationData.GetValue <string>(Constants.PLAYER_NAME_KEY); await LeaderboardService.SaveScoreAsync(playerName, score); await context.PostAsync($"💯 You are done! Your final score is: **{score}**."); await Utils.SendEventAsync(context, Constants.END_GAME_EVENT, score); // cleanup context.ConversationData.RemoveValue(Constants.LAST_PERSON_KEY); context.ConversationData.RemoveValue(Constants.RECENT_PEOPLE_KEY); context.ConversationData.RemoveValue(Constants.PLAYER_NAME_KEY); context.ConversationData.RemoveValue(Constants.SCORE_KEY); context.Done(true); }
private void generateLeaderboard() { var heros = LeaderboardService.GenerateLeaderboard(); var leaderboard = "<table class='table table-striped'>"; leaderboard += "<tr><th>Place</th><th>Credits</th><th>Hero</th></tr>"; var rank = 0; foreach (var hero in heros) { rank++; leaderboard += string.Format("<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>", rank, hero.Credits, hero.Name); } leaderboard += "</table>"; leaderboardLiteral.Text = leaderboard; }
public void InvokeILeaderboardViewModelFactory_CreateLeaderboardViewModelMethodOnce() { // Arrange var outputPerSecondViewModelDataProvider = new Mock <IOutputPerSecondViewModelDataProvider>(); var partialCircleSvgPathProvider = new Mock <IPartialCircleSvgPathProvider>(); var leaderboardViewModelFactory = new Mock <ILeaderboardViewModelFactory>(); var leaderboardService = new LeaderboardService(outputPerSecondViewModelDataProvider.Object, partialCircleSvgPathProvider.Object, leaderboardViewModelFactory.Object); var outputPerSecondViewModels = new List <OutputPerSecondViewModel>(); outputPerSecondViewModelDataProvider.Setup(p => p.GetTopHealingOnPageInDescendingOrder(It.IsAny <int>(), It.IsAny <int>())).Returns(outputPerSecondViewModels); var pageNumber = 1; // Act leaderboardService.GetTopHealingOnPage(pageNumber); // Assert leaderboardViewModelFactory.Verify(f => f.CreateLeaderboardViewModel(It.IsAny <int>(), It.IsAny <IList <OutputPerSecondViewModel> >()), Times.Once); }
public void Save() { LeaderboardService.SavePlayer(Player); }
public LeaderboardController(AccountService accountService, CategoryService categoryService, LeaderboardService leaderboardService) : base(accountService, categoryService) { _leaderboardService = leaderboardService; }
public LeaderboardModel(SqlManager sql) { sqlManager = sql; leaderboard = new LeaderboardService(sql); }
public AdminController(AccountService accountService, CategoryService categoryService, LeaderboardService leaderboardService, WebContentService webContentService) : base(accountService, categoryService) { _leaderboardService = leaderboardService; _webContentService = webContentService; }
public IEnumerable <LeaderboardRow> GetLeaderboardForWeek(int week, int year) { return(LeaderboardService.GetLeaderboardForWeek(week, year).OrderBy(x => x.Rank)); }
public LeaderboardController() { _leaderboardService = new LeaderboardService(UserToken); }
// DI via constructor public LeaderboardController(LeaderboardService service) { this._service = service; }
public LeaderboardController() { _context = new ApplicationDbContext(); _leaderboardService = new LeaderboardService(_context); }
public override void TestInitialize() { base.TestInitialize(); MockXboxLiveData.Load(Environment.CurrentDirectory + "\\Leaderboards\\MockDataForLeaderboardTests.json"); this.leaderboardService = new LeaderboardService(); }
public Reputation(ReputationService repService, LeaderboardService lbService, IMongoCollection <User> dbUsers) { _repService = repService; _lbService = lbService; _dbUsers = dbUsers; }
public LeaderboardController(LeaderboardService leaderboardService) { _leaderboardService = leaderboardService; }