public static void DeleteSession() { int IdSessao = GlobalController.instance.session.idSessao; List <Exercicio> allExercises = Exercicio.Read(); bool deleted = false; foreach (var exercise in allExercises) { if (exercise.idSessao == IdSessao) { GlobalController.instance.exercise = exercise; if (!deleted) { deleted = true; var slashedString = exercise.pontosExercicio.Split('/'); var sessionFolderName = slashedString[1]; string pathSession = string.Format("{0}/Exercicios/{1}", Application.dataPath, sessionFolderName); if (Directory.Exists(pathSession)) { Directory.Delete(pathSession); } } DeleteExerciseButton.DeleteExercise(); } } Sessao.DeleteValue(IdSessao); Flow.StaticPatient(); }
public static IEnumerator TestDeleteExercise() { Flow.StaticLogin(); yield return(new WaitForSeconds(0.5f)); 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.GetLast(); var fisio = Fisioterapeuta.GetLast(); var moves = Movimento.GetLast(); var sessions = Sessao.GetLast(); GlobalController.instance.user = pacient; GlobalController.instance.admin = fisio; GlobalController.instance.movement = moves; GlobalController.instance.session = sessions; Flow.StaticMovementsToExercise(); yield return(new WaitForSeconds(0.5f)); createExercise.CreateExercise(); var device = @"^(.*?(\bDevice|SDK\b)[^$]*)$"; Regex rgx1 = new Regex(device, RegexOptions.IgnoreCase); LogAssert.Expect(LogType.Error, rgx1); yield return(new WaitForSeconds(0.5f)); DeleteExerciseButton.DeleteExercise(); yield return(new WaitForSeconds(0.5f)); int IdExercicio = GlobalController.instance.exercise.idExercicio; List <PontosRotuloPaciente> allPrps = PontosRotuloPaciente.Read(); foreach (var prp in allPrps) { Assert.AreNotEqual(prp.idExercicio, IdExercicio); } var exers = Exercicio.Read(); foreach (var exer in exers) { Assert.AreNotEqual(exer.idExercicio, IdExercicio); } string pathEx = string.Format("{0}/Exercicios/{1}", Application.dataPath, GlobalController.instance.exercise.pontosExercicio); bool dir = System.IO.File.Exists(pathEx); Assert.AreEqual(dir, false); }