public void TestFilePass() { string relativePath = "..\\..\\TestFiles\\MOV045.MOI"; MOIPathParser pathParser = new MOIPathParser(relativePath); pathParser.Parse(); Assert.IsEmpty(pathParser.ParseErrors.ToList()); Assert.IsNotEmpty(pathParser.ParsedMOIFiles.ToList()); }
/// <summary> /// Button event that does the parsing of the files and opens a form to display the results. /// </summary> private void btnGo_Click(object sender, RoutedEventArgs e) { try { string moiPath = GetMoiPath(); MOIPathParser moiParser = new MOIPathParser(moiPath); moiParser.Parse(); DisplayParserResults(moiParser); } catch (Exception ex) { MessageBox.Show(this, ex.Message + Environment.NewLine + ex.StackTrace, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } }
/// <summary> /// Displays the results if there are any /// </summary> private void DisplayParserResults(MOIPathParser moiParser) { if (moiParser.ParsedMOIFiles.Count() == 0 && moiParser.ParseErrors.Count() == 0) { MessageBox.Show(this, "No MOI Files Found", this.Title, MessageBoxButton.OK, MessageBoxImage.Information); } else { OpenMOIFileViewerForm(moiParser); } }
/// <summary> /// Opens the MOI file viewer form to show the parse results. /// </summary> /// <param name="moiParser">The parser which should have already run</param> private void OpenMOIFileViewerForm(MOIPathParser moiParser) { MOIFileViewer moiFileViewer = new MOIFileViewer(); moiFileViewer.PopulateFileGrid(moiParser.ParsedMOIFiles); moiFileViewer.PopulateErrorGrid(moiParser.ParseErrors); moiFileViewer.Show(); }
public void TestNoFile() { string relativePath = "..\\..\\TestFiles\\NOTHERE.MOI"; MOIPathParser pathParser = new MOIPathParser(relativePath); pathParser.Parse(); }