Esempio n. 1
0
 public void SetFromTeam(Team team)
 {
     if (team == null)
     {
         score_.Text    = "?";
         load_.Enabled  = false;
         clear_.Enabled = false;
     }
     else
     {
         score_.Text = team.GetPoints(round_);
         bool has_score = team.Scores[Round - 1] != null;
         load_.Enabled  = has_score;
         clear_.Enabled = has_score;
     }
 }
Esempio n. 2
0
        public void TestScoreButtons()
        {
            Team team = SampleTeam();

            team_data_.Teams = new Team[] { team };
            Init();

            ScoreInfo score = score_control_.Score.Score();

            Assert.AreEqual(0, score.Points);
            Assert.IsFalse(score.IsValid());
            Assert.AreEqual("0", team.GetPoints(1));
            Assert.AreEqual("10", team.GetPoints(2));
            Assert.AreEqual("?", team.GetPoints(3));
            Assert.IsFalse(undo_.Enabled);

            ControlHelper.FireEvent(round1_.LoadControl, "Click");
            score = score_control_.Score.Score();
            Assert.AreEqual(0, score.Points);
            Assert.IsTrue(score.IsValid());
            Assert.AreEqual("0", team.GetPoints(1));
            Assert.AreEqual("10", team.GetPoints(2));
            Assert.AreEqual("?", team.GetPoints(3));
            Assert.IsFalse(undo_.Enabled);

            ControlHelper.FireEvent(round2_.LoadControl, "Click");
            score = score_control_.Score.Score();
            Assert.AreEqual(10, score.Points);
            Assert.IsTrue(score.IsValid());
            Assert.AreEqual("0", team.GetPoints(1));
            Assert.AreEqual("10", team.GetPoints(2));
            Assert.AreEqual("?", team.GetPoints(3));
            Assert.IsFalse(undo_.Enabled);

            /* TODO
             * EventScore score_data = score_control_.Score;
             * score_data.YellowBacteriaInBase = 4;
             * score_control_.Score = score_data;
             *
             * ControlHelper.FireEvent(round3_.SetControl, "Click");
             * score = score_control_.Score.Score();
             * Assert.AreEqual(0, score.Points);
             * Assert.IsFalse(score.IsValid());
             * Assert.AreEqual("0", team.GetPoints(1));
             * Assert.AreEqual("10", team.GetPoints(2));
             * Assert.AreEqual("28", team.GetPoints(3));
             * Assert.IsTrue(undo_.Enabled);
             *
             * ControlHelper.FireEvent(round3_.LoadControl, "Click");
             * score = score_control_.Score.Score();
             * Assert.AreEqual(28, score.Points);
             * Assert.IsTrue(score.IsValid());
             * Assert.AreEqual("0", team.GetPoints(1));
             * Assert.AreEqual("10", team.GetPoints(2));
             * Assert.AreEqual("28", team.GetPoints(3));
             * Assert.IsTrue(undo_.Enabled);
             *
             * score_data = score_control_.Score;
             * score_data.YellowBacteriaInBase = 6;
             * score_control_.Score = score_data;
             *
             * ControlHelper.FireEvent(round2_.SetControl, "Click");
             * Assert.AreEqual("0", team.GetPoints(1));
             * Assert.AreEqual("40", team.GetPoints(2));
             * Assert.AreEqual("28", team.GetPoints(3));
             * Assert.IsTrue(undo_.Enabled);
             *
             * ControlHelper.FireEvent(round2_.LoadControl, "Click");
             * ControlHelper.FireEvent(round1_.SetControl, "Click");
             * Assert.AreEqual("40", team.GetPoints(1));
             * Assert.AreEqual("40", team.GetPoints(2));
             * Assert.AreEqual("28", team.GetPoints(3));
             * Assert.IsTrue(undo_.Enabled);
             *
             * ControlHelper.FireEvent(undo_, "Click");
             * Assert.AreEqual("0", team.GetPoints(1));
             * Assert.AreEqual("40", team.GetPoints(2));
             * Assert.AreEqual("28", team.GetPoints(3));
             * Assert.IsFalse(undo_.Enabled);
             *
             * ControlHelper.FireEvent(round1_.ClearControl, "Click");
             * Assert.AreEqual("?", team.GetPoints(1));
             * Assert.AreEqual("40", team.GetPoints(2));
             * Assert.AreEqual("28", team.GetPoints(3));
             * Assert.IsTrue(undo_.Enabled);
             *
             * ControlHelper.FireEvent(round3_.ClearControl, "Click");
             * Assert.AreEqual("?", team.GetPoints(1));
             * Assert.AreEqual("40", team.GetPoints(2));
             * Assert.AreEqual("?", team.GetPoints(3));
             * Assert.IsTrue(undo_.Enabled);
             *
             * ControlHelper.FireEvent(round2_.ClearControl, "Click");
             * Assert.AreEqual("?", team.GetPoints(1));
             * Assert.AreEqual("?", team.GetPoints(2));
             * Assert.AreEqual("?", team.GetPoints(3));
             * Assert.IsTrue(undo_.Enabled);
             *
             * ControlHelper.FireEvent(undo_, "Click");
             * Assert.AreEqual("?", team.GetPoints(1));
             * Assert.AreEqual("40", team.GetPoints(2));
             * Assert.AreEqual("?", team.GetPoints(3));
             * Assert.IsFalse(undo_.Enabled);
             */
        }
Esempio n. 3
0
 public void SetFromTeam(Team team)
 {
     if (team == null) {
     score_.Text = "?";
     load_.Enabled = false;
     clear_.Enabled = false;
       } else {
     score_.Text = team.GetPoints(round_);
     bool has_score = team.Scores[Round - 1] != null;
     load_.Enabled = has_score;
     clear_.Enabled = has_score;
       }
 }