예제 #1
0
        public EmailProcessing(FetchAllUnseenPop3Client client, PlayersRepo playersRepo, AnswersRepo answersRepo,
		                       TagsRepo tagsRepo, Replier replier)
        {
            this.client = client;
            this.playersRepo = playersRepo;
            this.answersRepo = answersRepo;
            this.tagsRepo = tagsRepo;
            this.replier = replier;
        }
예제 #2
0
 public void Test()
 {
     const string filename = "answers";
     if (File.Exists(filename)) File.Delete(filename);
     using(var repo = new AnswersRepo(filename))
     {
         repo.Add(new PlayerAnswers{Answers = new[]{"a", "b c", "d"}, PlayerEmail = "*****@*****.**", Tag = "tag1", Timestamp = new DateTime(2012, 01, 01)});
         repo.Add(new PlayerAnswers { Answers = new[] { "a", "BBBBB", "DDDDD" }, PlayerEmail = "*****@*****.**", Tag = "tag1", Timestamp = new DateTime(2012, 01, 02) });
         repo.Add(new PlayerAnswers { Answers = new[] { "a", "b c", "d" }, PlayerEmail = "*****@*****.**", Tag = "TAG2", Timestamp = new DateTime(2012, 01, 01) });
         repo.Add(new PlayerAnswers { Answers = new[] { "a", "b c", "d" }, PlayerEmail = "*****@*****.**", Tag = "TAG2", Timestamp = new DateTime(2012, 01, 01) });
     }
     using(var repo = new AnswersRepo(filename))
     {
         Assert.AreEqual(1, repo.GetFor("tag1").Count);
         Assert.AreEqual(2, repo.GetFor("TAG2").Count);
     }
 }
예제 #3
0
 public void Test()
 {
     using (var playersRepo = new PlayersRepo("players"))
     using (var answersRepo = new AnswersRepo("answers"))
     using (var tagsRepo = new TagsRepo("tags"))
     {
         File.WriteAllText("index.html",
                           Razor.Parse(File.ReadAllText("index.cshtml"),
                                       new GameLogic().Calculate(playersRepo, answersRepo, tagsRepo)
                           	));
     }
     Process.Start("index.html");
 }
예제 #4
0
 public GameResult[] Calculate(PlayersRepo playersRepo, AnswersRepo answersRepo, TagsRepo tagsRepo)
 {
     return
         tagsRepo.Tags.Select(
             tag => GetResults(tag, playersRepo, answersRepo.GetFor(tag.Tag))).OrderByDescending(res => res.Tag.Finish).ToArray();
 }