private Boolean createTheUser() { EvaluetionMethod em; float lowerLimit, higherLimit, step; user = new User(tbLogin.Text, password, tbUserName.Text); if (!(float.TryParse(cbbLowerLimit.Text, out lowerLimit) && float.TryParse(cbbHigherLimit.Text, out higherLimit) && float.TryParse(cbbSteps.Text, out step))) { MessageBox.Show("Preencha todos os campos relativos a como avaliar os vídeos"); return false; } if (higherLimit < step) { MessageBox.Show("Assim a avaliação não vai funcionar. " + "Diminua os passos ou aumente o limite superior"); return false; } if (rbtnGrade.Checked) em = EvaluetionMethod.Grade; else em = EvaluetionMethod.Stars; user.setEvaluetionMethodInfo(em, lowerLimit, higherLimit, step); return true; }
private User createUserFromDataReader(MySqlDataReader dataReader) { if (!dataReader.HasRows) return null; dataReader.Read(); User user = new User(dataReader["login"].ToString(), dataReader["password"].ToString(), dataReader["name"].ToString()); EvaluetionMethod em; int evaluetionMethod = dataReader.GetInt16("evaluetionMethod"); if(evaluetionMethod == 0) em = EvaluetionMethod.Grade; else em = EvaluetionMethod.Stars; user.setEvaluetionMethodInfo(em, (float) dataReader.GetInt16("lowerLimit"), (float) dataReader.GetInt16("higherLimit"), float.Parse(dataReader["step"].ToString())); return user; }
public void setEvaluetionMethodInfoTest() { string login = string.Empty; // TODO: Initialize to an appropriate value string password = string.Empty; // TODO: Initialize to an appropriate value string name = string.Empty; // TODO: Initialize to an appropriate value User target = new User(login, password, name); // TODO: Initialize to an appropriate value EvaluetionMethod evaluetionMethod = new EvaluetionMethod(); // TODO: Initialize to an appropriate value float lowerLimit = 0F; // TODO: Initialize to an appropriate value float higherLimit = 0F; // TODO: Initialize to an appropriate value float step = 0F; // TODO: Initialize to an appropriate value target.setEvaluetionMethodInfo(evaluetionMethod, lowerLimit, higherLimit, step); Assert.Inconclusive("A method that does not return a value cannot be verified."); }