public void CheckMessage()
        {
            var current = CheckPoint.Current();
            var score   = new CycleScore(current.Cycle, DateTimeOffset.Now.Ticks);
            var updater = new Mock <ICycleScoreUpdater>().Object;

            score.SetScore(1, new UpdateScore {
                EnlightenedScore = 1000, ResistanceScore = 0
            }, updater);
            score.SetScore(2, new UpdateScore {
                EnlightenedScore = 1000, ResistanceScore = 0
            }, updater);
            score.SetScore(3, new UpdateScore {
                EnlightenedScore = 1000, ResistanceScore = 0
            }, updater);
            score.SetScore(4, new UpdateScore {
                EnlightenedScore = 1000, ResistanceScore = 0
            }, updater);
            score.SetScore(5, new UpdateScore {
                EnlightenedScore = 1000, ResistanceScore = 0
            }, updater);
            score.SetScore(6, new UpdateScore {
                EnlightenedScore = 1000, ResistanceScore = 0
            }, updater);
            score.SetScore(7, new UpdateScore {
                EnlightenedScore = 1000, ResistanceScore = 0
            }, updater);

            Console.WriteLine(score.ToString());
        }
        public string SetScore(int cycleId, int checkpoint, UpdateScore newScore)
        {
            //Do you need to explicitly overwrite
            //is it the same score?
            //was it okay?
            var cycle  = GetScoreForCycle(cycleId);
            var reason = cycle.IsUpdatable(newScore, checkpoint, CheckPoint.Current());

            if (!string.IsNullOrEmpty(reason))
            {
                return(reason);
            }
            if (!cycle.SetScore(checkpoint, newScore, _scoreUpdater))
            {
                return("SetScore Failed. Probably someone else updated it already.");
            }

            if (!cycle.HasMissingCPs())
            {
                PostToSlack(cycle);
                return("post to slack");
            }

            return("OK");
        }
        public void SetScoreTest()
        {
            var factory = new AzureScoreFactory("Paste Connection String Here");

            //179,300	147,311
            var currentCycle      = CheckPoint.Current().Cycle;
            var currentCycleScore = factory.GetScoreForCycle(currentCycle);

            currentCycleScore.SetScore(1, new UpdateScore(new CpScore(179300, 147311), 0), factory);
        }
        public void MissingCheckpoints()
        {
            var score = new CycleScore(CheckPoint.Current().Cycle, DateTimeOffset.Now.Ticks);

            foreach (var cp in score.MissingCPs())
            {
                Console.WriteLine(cp.Cp);
            }
            score.SetScore(2, new UpdateScore(new CpScore(1000, 0), 0), new Mock <ICycleScoreUpdater>().Object);
            foreach (var cp in score.MissingCPs())
            {
                Console.WriteLine(cp.Cp);
            }
        }
        public void SkipCP()
        {
            var cp      = CheckPoint.Current();
            var score   = new CycleScore(cp.Cycle, DateTimeOffset.Now.Ticks);
            var updater = new Mock <ICycleScoreUpdater>().Object;

            score.SetScore(2, new UpdateScore {
                EnlightenedScore = 1000, ResistanceScore = 0
            }, updater);
            score.SetScore(3, new UpdateScore {
                EnlightenedScore = 500, ResistanceScore = 0
            }, updater);
            score.SetScore(4, new UpdateScore {
                EnlightenedScore = 500, ResistanceScore = 1999
            }, updater);

            Console.WriteLine(string.Join("\n", score.Summary(false)));
        }
 public int CurrentCycle()
 {
     return(CheckPoint.Current().Cycle.Id);
 }
        public void PostToSlack()
        {
            var currentCycle = _scoreUpdater.GetScoreForCycle(CheckPoint.Current().Cycle);

            PostToSlack(currentCycle);
        }