public void ReplaceTextDoesNotExistBeforeReplace() { var templateApi = new WordAPI(TemplatePath); foreach (var pair in FindAndReplacePairs) { Assert.IsFalse(templateApi.ContainsText(pair.Value, false), templatePreconditionError + TemplatePath); } templateApi.Close(); }
public void SearchTextDoesNotExistAfterReplace() { WordInterface = new WordAPI(TemplatePath, false); WordInterface.FindAndReplace(FindAndReplacePairs, false); foreach (var pair in FindAndReplacePairs) { Assert.IsFalse(WordInterface.ContainsText(pair.Key, false)); } WordInterface.Close(); }
public List <Discipline> ParsePlan() { List <Discipline> disciplinesCopy = new List <Discipline>(disciplenes); //try { for (int j = 1; j < table.Count; j++) { Word.Range range = table[j].Range; Word.Cells cells = range.Cells; string key = "Знать"; Dictionary <string, List <string> > requirementsForStudent = new Dictionary <string, List <string> >(); requirementsForStudent.Add("Знать", new List <string>()); requirementsForStudent.Add("Уметь", new List <string>()); requirementsForStudent.Add("Владеть", new List <string>()); string cell1 = cells[1].Range.Text.Trim(); if (cell1.StartsWith("В результате изучения")) { foreach (Discipline disciplene in disciplenes) { if (cells[1].Range.Text.Contains(disciplene.Name)) { string temporary = ""; for (int i = 1; i <= cells.Count; i++) { Word.Cell cell = cells[i]; Word.Range updateRange = cell.Range; string text = updateRange.Text; text = text.Replace("\v", ""); text = text.Replace("\r", ""); text = text.Replace("\a", ""); text = text.Trim(); if (text.ToLower().Equals("знать:")) { temporary = "знать:"; continue; } else if (text.ToLower().Equals("уметь:")) { temporary = "уметь:"; continue; } else if (text.ToLower().Equals("владеть:")) { temporary = "владеть:"; continue; } text = text.Replace(";", ""); text = text.Replace(".", ""); if (temporary.Equals("знать:")) { disciplinesCopy.Find(x => x.Name.Equals(disciplene.Name)).RequirementsForStudent["Знать:"].Add(text); } else if (temporary.Equals("уметь:")) { disciplinesCopy.Find(x => x.Name.Equals(disciplene.Name)).RequirementsForStudent["Уметь:"].Add(text); } else if (temporary.Equals("владеть:")) { disciplinesCopy.Find(x => x.Name.Equals(disciplene.Name)).RequirementsForStudent["Владеть:"].Add(text); } } } } } } disciplenes = getMethodicalInstructionsForRest(disciplinesCopy); WordAPI.Close(doc); //} //catch (Exception e) //{ // doc.Close(); // new ExceptionWindow() // .Show(); //} return(disciplenes); }