/// <summary> /// Entry point of program. /// </summary> static void Main() { try { List <Test> listTests = new List <Test>(); Command command = new CommandOpen(new CommandCheckLinkPresentByHref( new CommandCheckLinkPresentByName(new CommandCheckPageTitle(new CommandCheckPageContains(null))))); using (StreamWriter streamWriter = new StreamWriter(Resource.outputFile)) { using (StreamReader streamReader = new StreamReader(Resource.inputFile)) { string line = string.Empty; while ((line = streamReader.ReadLine()) != null) { Test test = new Test(line); listTests.Add(test); command.Execute(test); streamWriter.WriteLine(test.Result); } } TimeSpan totalTime = TimeSpan.Zero; int pasedTests = 0; int failedTests = 0; foreach (Test test in listTests) { totalTime += test.RunTime; if (test.IsSuccess) { pasedTests++; } else { failedTests++; } } TimeSpan averageTime = TimeSpan.FromTicks(totalTime.Ticks / (pasedTests + failedTests)); streamWriter.WriteLine($"Total tests: {pasedTests + failedTests}"); streamWriter.WriteLine($"Passed/Failed: {pasedTests}/{failedTests}"); streamWriter.WriteLine($"Total time: {totalTime.ToString(@"s\.fff")}"); streamWriter.WriteLine($"Average time: {averageTime.ToString(@"s\.fff")}"); } } catch (FileNotFoundException) { Console.WriteLine("File couldn't be read."); } catch (Exception) { Console.WriteLine("Error."); } }
public void DoProjectOpen(FileInfo dsmFile) { if (ConfirmModelSaved()) { IDsmModel newModel = new DsmModel(null, null); ICommand cmd = new CommandOpen(newModel, dsmFile); CursorStateHelper csh = new CursorStateHelper(this, Cursors.WaitCursor); Refresh(); ModelessMessageBox msg = new ModelessMessageBox("Loading project file"); try { cmd.Execute(msg.UpdateProgress); if (cmd.Completed) { SetModel(newModel); _matrixControl.Size = new Size(panel1.ClientSize.Width, panel1.ClientSize.Height); } } catch (DsmException dsmEx) { MessageBox.Show("Unable to load DSM fom file for the following reason: " + Environment.NewLine + Environment.NewLine + dsmEx, "Dependency Structure Matrix", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception ex) { ErrorDialog.Show(ex.ToString()); } finally { msg.Dispose(); csh.Reset(); } if ((newModel != null) && (newModel.ModelFilename != null)) { this.Text = "DSM Viewer - " + newModel.ModelFilename; } } }