public void CalcularTiempo() { var instancia = new tiempoJugado(); var segundos = instancia.CalcularTiempo(20); Assert.AreEqual(segundos, "0:0:20"); var segundos2 = instancia.CalcularTiempo(140); Assert.AreEqual(segundos2, "0:2:20"); }
// Accions al buscar Joc /// <summary> /// Acciones al pulsar el boton de buscar. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { try { buscadortabla.Rows.Clear(); foreach (juego juegos in con.guardarEnTablaBuscar(buscadortxt.Text)) { tiempoJugado tempsJugat = new tiempoJugado(juegos.NombreJuego, usuario.Text); buscadortabla.Rows.Add(new object[] { juegos.NombreJuego, tempsJugat.CalcularTiempo(con.tiempoJugado(tempsJugat)) }); } } catch { logs.Save("Error al cargar datos a dataGridView!", 160); } }
////////////////////////////////////////// /// Carregar Dades ////////////////////////////////////////// //Carregar les hores jugades de cada joc!!! /// <summary> /// Cargar datos a la pantalla. /// </summary> private void labelhoras() { //carregar taula buscadorjoc!!! try { buscadortabla.Rows.Clear(); foreach (juego juegos in con.guardarEnTabla("juegos")) { tiempoJugado tempsJugat = new tiempoJugado(juegos.NombreJuego, usuario.Text); buscadortabla.Rows.Add(new object[] { juegos.NombreJuego, tempsJugat.CalcularTiempo(con.tiempoJugado(tempsJugat)) }); } tiempoJugado JuegoBeta = new tiempoJugado("JuegoBeta", usuario.Text); tiempoJugado jocPDE = new tiempoJugado("joc_pde", usuario.Text); tiempoJugado arquer = new tiempoJugado("arquer", usuario.Text); tiempoJugado wegi = new tiempoJugado("wegi", usuario.Text); int tiempoWegi = con.tiempoJugado(wegi); int tiempoJuegoBeta = con.tiempoJugado(JuegoBeta); int tiempoJuegoPDE = con.tiempoJugado(jocPDE); int tiempoArquer = con.tiempoJugado(arquer); tiempoJugadoJuegoBeta.Text = "Tiempo Jugado: " + tJugat.CalcularTiempo(tiempoJuegoBeta); tiempoJugadoJocPDE.Text = "Tiempo Jugado: " + tJugat.CalcularTiempo(tiempoJuegoPDE); tiempoJugadoArquer.Text = "Tiempo Jugado: " + tJugat.CalcularTiempo(tiempoArquer); tiempoJugadoWegi.Text = "Tiempo Jugado: " + tJugat.CalcularTiempo(tiempoWegi); lblTotalJugado.Text = tJugat.CalcularTiempo(con.tiempoJugadototal(usuario.Text)); lblUser.Text = usuario.Text; txtEmail.Text = con.mysqlEmail(usuario.Text); sexe.Text = con.mysqlSexe(usuario.Text); dateNeixament.Text = con.mysqlFechaNacimiento(usuario.Text); } catch { logs.Save("Error en cargar labels!!", 130); } }