コード例 #1
0
        public void VerificandoTempoDiminuindo()
        {
            var controle = new ControleTempo(null);

            controle.ControlarTempo(1);
            var tempoInicial = controle.TempoRestante;

            controle.ControlarTempo(2);
            Assert.AreEqual(tempoInicial - 1, controle.TempoRestante);
        }
コード例 #2
0
 /// <summary>
 /// Abre o controle do tempo para reiniciar ou parar o tempo de execução
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Pessoa_DoubleClick(object sender, EventArgs e)
 {
     timer.Stop();
     ControleTempo = ControleTempo ?? new FrmTempo(delegate(decimal retorno)
     {
         if (retorno > 0)
         {
             _tempo          = retorno;
             _tempoExecutado = 0;
         }
         timer.Start();
         ControleTempo.Hide();
         return(0);
     });
     ControleTempo.ShowDialog();
 }
コード例 #3
0
 public void VerificandoFimDoJogo()
 {
     try
     {
         var controle = new ControleTempo(null);
         controle.ControlarTempo(1);
         var tempoInicial = controle.TempoRestante;
         controle.ControlarTempo(Configuracao.TempoPadrao + 1);
         Assert.Fail();
     }
     catch (AcabouTempoException)
     {
     }
     catch (Exception)
     {
         Assert.Fail();
     }
 }