public static void TestInstanciateExercise() { Pessoa.Insert("patient name1", "m", "1995-01-01", "6198732711", null); Pessoa.Insert("physio name1", "m", "1995-01-03", "6198732713", null); Fisioterapeuta.Insert(2, "abracadabra1", "demais1", null, null); Paciente.Insert(1, null); Movimento.Insert(1, "levantamento de peso", "asuhasu/caminhoy.com", null); Sessao.Insert(1, 1, "1940-10-10", null); var pacient = Paciente.Read(); var moves = Movimento.Read(); var sessions = Sessao.Read(); Exercicio.Insert(pacient[pacient.Count - 1].idPaciente, moves[moves.Count - 1].idMovimento, sessions[sessions.Count - 1].idSessao, "2-Tanto_Fazm/2018-05-30-18-33/24-Ahaha_Hahaha-182944.points", null); UnityEditor.SceneManagement.EditorSceneManager.OpenScene(Application.dataPath + "/Scenes/ExercisesToReview.unity"); var panelphysio = GameObject.Find("PanelShowMovements"); var instanciate = panelphysio.GetComponentInChildren <instanciateExercise>(); var exers = Exercicio.Read(); instanciate.ButtonSpawner(60, exers[exers.Count - 1]); int countExers = CountGameObjectsWithSameName("Exercise da Reproduce Exercise(Clone)"); Assert.AreEqual(1, countExers); }
/** * Salva o paciente no banco. */ public static void CreateExercise() { string patientUnderscored = (GlobalController.instance.user.persona.nomePessoa).Replace(' ', '_'); string pathSave = GlobalController.instance.user.idPessoa + "-"; pathSave += patientUnderscored + "/"; pathSave += GlobalController.instance.session.dataSessao + "/"; var token = (GlobalController.instance.movement.pontosMovimento).Split('/'); string date = DateTime.Now.ToString("ss", System.Globalization.DateTimeFormatInfo.InvariantInfo); Debug.Log(GlobalController.instance.movement.pontosMovimento); Debug.Log(token[0]); Debug.Log(pathSave); pathSave += date + "-" + token[1]; Exercicio.Insert(GlobalController.instance.user.idPaciente, GlobalController.instance.movement.idMovimento, GlobalController.instance.session.idSessao, pathSave, null); List <Exercicio> exercises = Exercicio.Read(); GlobalController.patientOrPhysio = false; GlobalController.instance.exercise = exercises[exercises.Count - 1]; if (GlobalController.Sensor == false) { Flow.StaticRealtimeGraphKinectPatient(); } else { Flow.StaticRealtimeGraphUDPPatient(); } }
public static void TestExercicioReadValue() { using (var conn = new SqliteConnection(GlobalController.path)) { conn.Open(); Pessoa.Insert("patient name1", "m", "1995-01-01", "6198732711", null); Pessoa.Insert("patient name2", "m", "1995-01-02", "6198732712", null); Pessoa.Insert("physio name1", "m", "1995-01-03", "6198732713", null); Pessoa.Insert("physio name2", "m", "1995-01-04", "6198732714", null); Fisioterapeuta.Insert(3, "abracadabra1", "demais1", null, null); Fisioterapeuta.Insert(4, "abracadabra2", "demais2", null, null); Paciente.Insert(1, null); Paciente.Insert(2, null); Movimento.Insert(1, "levantamento de peso", "caminhoy.com", null); Movimento.Insert(2, "levantamento de pena", "caminhox.com", null); Sessao.Insert(1, 1, "1940-10-10", null); Sessao.Insert(1, 2, "2010-10-10", null); Exercicio.Insert(1, 1, 1, "caminhopaciente4.ponto", null); Exercicio.Insert(1, 2, 1, "caminhopaciente6.ponto", "levantou mt coisa1"); Exercicio.Insert(2, 1, 2, "caminhopaciente8.ponto", null); Exercicio.Insert(2, 2, 2, "caminhopaciente10.ponto", "levantou mt coisa2"); for (int i = 1, k = 1, j = 1; i <= 4; ++i, k = 3 - k) { Exercicio auxEx = Exercicio.ReadValue(i); Assert.AreEqual(auxEx.idExercicio, i); Assert.AreEqual(auxEx.idPaciente, j); Assert.AreEqual(auxEx.idMovimento, k); Assert.AreEqual(auxEx.idSessao, j); Assert.AreEqual(auxEx.pontosExercicio, string.Format("caminhopaciente{0}.ponto", i + j + j + k)); if (i == 1 || i == 3) { Assert.AreEqual(auxEx.descricaoExercicio, null); } else { Assert.AreEqual(auxEx.descricaoExercicio, string.Format("levantou mt coisa{0}", j)); } if (i == 2) { j++; } } conn.Dispose(); conn.Close(); } }
public static void TestPatientLabelPointsRead() { using (var conn = new SqliteConnection(GlobalController.path)) { conn.Open(); Pessoa.Insert("patient name1", "m", "1995-01-01", "6198732711", null); Pessoa.Insert("patient name2", "m", "1995-01-02", "6198732712", null); Pessoa.Insert("patient name3", "m", "1995-01-03", "6198732713", null); Pessoa.Insert("physio name1", "m", "1995-01-04", "6198732714", null); Pessoa.Insert("physio name2", "m", "1995-01-05", "6198732715", null); Pessoa.Insert("physio name3", "m", "1995-01-06", "6198732716", null); Fisioterapeuta.Insert(4, "abracadabra1", "demais1", null, null); Fisioterapeuta.Insert(5, "abracadabra2", "demais2", null, null); Fisioterapeuta.Insert(6, "abracadabra3", "demais3", null, null); Paciente.Insert(1, null); Paciente.Insert(2, null); Paciente.Insert(3, null); Movimento.Insert(1, "Movimento1", "Musculo Redondo Maior", null); Movimento.Insert(2, "Movimento2", "Musculo Redondo Maior", "Dificuldade nesse local"); Movimento.Insert(3, "Movimento3", "Musculo Redondo Maior", "Dificuldade nesse local"); Sessao.Insert(1, 1, "2018-03-01", null); Sessao.Insert(2, 2, "2018-03-02", "procedimento2"); Sessao.Insert(3, 3, "2018-03-03", "procedimento3"); Exercicio.Insert(1, 1, 1, "caminhopaciente1.ponto", null); Exercicio.Insert(1, 2, 1, "caminhopaciente2.ponto", "levantou mt coisa1"); Exercicio.Insert(2, 1, 2, "caminhopaciente3.ponto", null); Exercicio.Insert(2, 2, 2, "caminhopaciente4.ponto", "levantou mt coisa2"); Exercicio.Insert(3, 1, 3, "caminhopaciente5.ponto", null); Exercicio.Insert(3, 2, 3, "caminhopaciente6.ponto", "levantou mt coisa3"); PontosRotuloPaciente.Insert(1, "Aperfeicoando1", 05.00f, 06.00f); PontosRotuloPaciente.Insert(2, "Aperfeicoando2", 06.00f, 07.00f); PontosRotuloPaciente.Insert(3, "Aperfeicoando3", 07.00f, 08.00f); List <PontosRotuloPaciente> allPatientsLabelPoints = PontosRotuloPaciente.Read(); for (int i = 0; i < allPatientsLabelPoints.Count; ++i) { Assert.AreEqual(allPatientsLabelPoints[i].exer.idExercicio, i + 1); Assert.AreEqual(allPatientsLabelPoints[i].idRotuloPaciente, i + 1); Assert.AreEqual(allPatientsLabelPoints[i].estagioMovimentoPaciente, string.Format("Aperfeicoando{0}", i + 1)); Assert.AreEqual(allPatientsLabelPoints[i].tempoInicial, 05.00f + i); Assert.AreEqual(allPatientsLabelPoints[i].tempoFinal, 06.00f + i); } conn.Dispose(); conn.Close(); } return; }
public static void TestExercicioDeleteValue() { using (var conn = new SqliteConnection(GlobalController.path)) { conn.Open(); Pessoa.Insert("patient name1", "m", "1995-01-01", "6198732711", null); Pessoa.Insert("patient name2", "m", "1995-01-02", "6198732712", null); Fisioterapeuta.Insert(2, "abracadabra1", "demais1", null, null); Paciente.Insert(1, null); Movimento.Insert(1, "levantamento de peso", "caminhoy.com", null); Sessao.Insert(1, 1, "1940-10-10", null); Exercicio.Insert(1, 1, 1, "caminhopaciente4.ponto", null); var check = "SELECT EXISTS(SELECT 1 FROM 'EXERCICIO' WHERE \"idExercicio\" = \"1\" LIMIT 1)"; var result = 0; using (var cmd = new SqliteCommand(check, conn)) { using (IDataReader reader = cmd.ExecuteReader()) { try { while (reader.Read()) { if (!reader.IsDBNull(0)) { result = reader.GetInt32(0); } } } finally { reader.Dispose(); reader.Close(); } } cmd.Dispose(); } Assert.AreEqual(result, 1); Exercicio.DeleteValue(1); result = 0; using (var cmd = new SqliteCommand(check, conn)) { using (IDataReader reader = cmd.ExecuteReader()) { try { while (reader.Read()) { if (!reader.IsDBNull(0)) { result = reader.GetInt32(0); } } } finally { reader.Dispose(); reader.Close(); } } cmd.Dispose(); } Assert.AreEqual(result, 0); conn.Dispose(); conn.Close(); } }
public static void TestExercicioUpdate() { using (var conn = new SqliteConnection(GlobalController.path)) { conn.Open(); Pessoa.Insert("patient name1", "m", "1995-01-01", "6198732711", null); Pessoa.Insert("patient name2", "m", "1995-01-02", "6198732712", null); Pessoa.Insert("physio name1", "m", "1995-01-03", "6198732713", null); Pessoa.Insert("physio name2", "m", "1995-01-04", "6198732714", null); Fisioterapeuta.Insert(3, "abracadabra1", "demais1", null, null); Fisioterapeuta.Insert(4, "abracadabra2", "demais2", null, null); Paciente.Insert(1, null); Paciente.Insert(2, null); Movimento.Insert(1, "levantamento de peso", "caminhoy.com", null); Movimento.Insert(2, "levantamento de pena", "caminhox.com", null); Sessao.Insert(1, 1, "1940-10-10", null); Sessao.Insert(1, 2, "2010-10-10", null); Exercicio.Insert(1, 1, 1, "caminhopaciente4.ponto", null); Exercicio.Insert(1, 2, 1, "caminhopaciente6.ponto", "levantou mt coisa1"); Exercicio.Insert(2, 1, 2, "caminhopaciente8.ponto", null); Exercicio.Insert(2, 2, 2, "caminhopaciente10.ponto", "levantou mt coisa2"); Exercicio.Update(2, 1, 2, 1, "caminhopaciente6.ponto", null); Exercicio.Update(4, 2, 2, 2, "caminhopaciente10.ponto", null); var check = "SELECT * FROM EXERCICIO;"; var id = 0; var result = ""; int i = 1; int j = 1; int k = 1; using (var cmd = new SqliteCommand(check, conn)) { using (IDataReader reader = cmd.ExecuteReader()) { try { while (reader.Read()) { if (!reader.IsDBNull(0)) { id = reader.GetInt32(0); Assert.AreEqual(id, i); } if (!reader.IsDBNull(1)) { id = reader.GetInt32(1); Assert.AreEqual(id, j); } if (!reader.IsDBNull(2)) { id = reader.GetInt32(2); Assert.AreEqual(id, k); } if (!reader.IsDBNull(3)) { id = reader.GetInt32(3); Assert.AreEqual(id, j); } if (!reader.IsDBNull(4)) { result = reader.GetString(4); Assert.AreEqual(result, string.Format("caminhopaciente{0}.ponto", i + j + j + k)); } Assert.AreEqual(reader.IsDBNull(5), true); i++; if (i == 3) { j++; } k = 3 - k; } } finally { reader.Dispose(); reader.Close(); } } cmd.Dispose(); } conn.Dispose(); conn.Close(); } }
public static void TestPatientLabelPointsDeleteValue() { using (var conn = new SqliteConnection(GlobalController.path)) { conn.Open(); Pessoa.Insert("patient name1", "m", "1995-01-01", "6198732711", null); Pessoa.Insert("patient name2", "m", "1995-01-02", "6198732712", null); Pessoa.Insert("patient name3", "m", "1995-01-03", "6198732713", null); Pessoa.Insert("physio name1", "m", "1995-01-04", "6198732714", null); Pessoa.Insert("physio name2", "m", "1995-01-05", "6198732715", null); Pessoa.Insert("physio name3", "m", "1995-01-06", "6198732716", null); Fisioterapeuta.Insert(4, "abracadabra1", "demais1", null, null); Fisioterapeuta.Insert(5, "abracadabra2", "demais2", null, null); Fisioterapeuta.Insert(6, "abracadabra3", "demais3", null, null); Paciente.Insert(1, null); Paciente.Insert(2, null); Paciente.Insert(3, null); Movimento.Insert(1, "Movimento1", "Musculo Redondo Maior", null); Movimento.Insert(2, "Movimento2", "Musculo Redondo Maior", "Dificuldade nesse local"); Movimento.Insert(3, "Movimento3", "Musculo Redondo Maior", "Dificuldade nesse local"); Sessao.Insert(1, 1, "2018-03-01", null); Sessao.Insert(2, 2, "2018-03-02", "procedimento2"); Sessao.Insert(3, 3, "2018-03-03", "procedimento3"); Exercicio.Insert(1, 1, 1, "caminhopaciente1.ponto", null); Exercicio.Insert(1, 2, 1, "caminhopaciente2.ponto", "levantou mt coisa1"); Exercicio.Insert(2, 1, 2, "caminhopaciente3.ponto", null); Exercicio.Insert(2, 2, 2, "caminhopaciente4.ponto", "levantou mt coisa2"); Exercicio.Insert(3, 1, 3, "caminhopaciente5.ponto", null); Exercicio.Insert(3, 2, 3, "caminhopaciente6.ponto", "levantou mt coisa3"); PontosRotuloPaciente.Insert(1, "Aperfeicoando1", 05.00f, 06.00f); PontosRotuloPaciente.Insert(2, "Aperfeicoando2", 06.00f, 07.00f); PontosRotuloPaciente.Insert(3, "Aperfeicoando3", 07.00f, 08.00f); var check = "SELECT EXISTS(SELECT 1 FROM 'PONTOSROTULOPACIENTE' WHERE \"idRotuloPaciente\" = \"1\" LIMIT 1)"; var result = 0; using (var cmd = new SqliteCommand(check, conn)) { using (IDataReader reader = cmd.ExecuteReader()) { try { while (reader.Read()) { if (!reader.IsDBNull(0)) { result = reader.GetInt32(0); } } } finally { reader.Dispose(); reader.Close(); } } cmd.Dispose(); } Assert.AreEqual(result, 1); PontosRotuloPaciente.DeleteValue(1); result = 0; using (var cmd = new SqliteCommand(check, conn)) { using (IDataReader reader = cmd.ExecuteReader()) { try { while (reader.Read()) { if (!reader.IsDBNull(0)) { result = reader.GetInt32(0); } } } finally { reader.Dispose(); reader.Close(); } } cmd.Dispose(); } Assert.AreEqual(result, 0); conn.Dispose(); conn.Close(); } return; }
public static void TestPatientLabelPointsUpdate() { using (var conn = new SqliteConnection(GlobalController.path)) { conn.Open(); Pessoa.Insert("patient name1", "m", "1995-01-01", "6198732711", null); Pessoa.Insert("patient name2", "m", "1995-01-02", "6198732712", null); Pessoa.Insert("patient name3", "m", "1995-01-03", "6198732713", null); Pessoa.Insert("physio name1", "m", "1995-01-04", "6198732714", null); Pessoa.Insert("physio name2", "m", "1995-01-05", "6198732715", null); Pessoa.Insert("physio name3", "m", "1995-01-06", "6198732716", null); Fisioterapeuta.Insert(4, "abracadabra1", "demais1", null, null); Fisioterapeuta.Insert(5, "abracadabra2", "demais2", null, null); Fisioterapeuta.Insert(6, "abracadabra3", "demais3", null, null); Paciente.Insert(1, null); Paciente.Insert(2, null); Paciente.Insert(3, null); Movimento.Insert(1, "Movimento1", "Musculo Redondo Maior", null); Movimento.Insert(2, "Movimento2", "Musculo Redondo Maior", "Dificuldade nesse local"); Movimento.Insert(3, "Movimento3", "Musculo Redondo Maior", "Dificuldade nesse local"); Sessao.Insert(1, 1, "2018-03-01", null); Sessao.Insert(2, 2, "2018-03-02", "procedimento2"); Sessao.Insert(3, 3, "2018-03-03", "procedimento3"); Exercicio.Insert(1, 1, 1, "caminhopaciente4.ponto", null); Exercicio.Insert(1, 2, 1, "caminhopaciente6.ponto", "levantou mt coisa1"); Exercicio.Insert(2, 1, 2, "caminhopaciente8.ponto", null); Exercicio.Insert(2, 2, 2, "caminhopaciente10.ponto", "levantou mt coisa2"); Exercicio.Insert(3, 1, 3, "caminhopaciente12.ponto", null); Exercicio.Insert(3, 2, 3, "caminhopaciente14.ponto", "levantou mt coisa3"); PontosRotuloPaciente.Insert(1, "Aperfeicoando1", 05.00f, 06.00f); PontosRotuloPaciente.Insert(2, "Aperfeicoando2", 06.00f, 07.00f); PontosRotuloPaciente.Insert(3, "Aperfeicoando3", 07.00f, 08.00f); PontosRotuloPaciente.Update(1, 3, "SemResultados1", 10.00f, 11.00f); PontosRotuloPaciente.Update(2, 2, "SemResultados2", 11.00f, 12.00f); PontosRotuloPaciente.Update(3, 1, "SemResultados3", 12.00f, 13.00f); var check = "SELECT * FROM PONTOSROTULOPACIENTE;"; var id = 0; var result = ""; int i = 1; float resultFloat = 0.00f; using (var cmd = new SqliteCommand(check, conn)) { using (IDataReader reader = cmd.ExecuteReader()) { try { while (reader.Read()) { if (!reader.IsDBNull(0)) { id = reader.GetInt32(0); Assert.AreEqual(id, i); } if (!reader.IsDBNull(1)) { id = reader.GetInt32(1); Assert.AreEqual(id, 4 - i); } if (!reader.IsDBNull(2)) { result = reader.GetString(2); Assert.AreEqual(result, string.Format("SemResultados{0}", i)); } if (!reader.IsDBNull(3)) { resultFloat = reader.GetFloat(3); Assert.AreEqual(resultFloat, 09.00f + i); } if (!reader.IsDBNull(4)) { resultFloat = reader.GetFloat(4); Assert.AreEqual(resultFloat, 10.00f + i); } i++; } } finally { reader.Dispose(); reader.Close(); } } cmd.Dispose(); } conn.Dispose(); conn.Close(); } return; }