mattercontrol/Testing/TestingDispatch.cs
larsbrubaker eb41dbc01f Putting in new release tests to make sure all sorts of things are good when we deploy.
Have a new command line argument of test that will run release tests.
Put in two tests to ensure that we don't have DEBUG defined when we ship release builds.
Wrote a exception dumper that will output data when we have an error.
2014-02-26 11:05:58 -08:00

42 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
namespace MatterHackers.MatterControl.Testing
{
public class TestingDispatch
{
string errorLogFileName = null;
public TestingDispatch()
{
errorLogFileName = string.Format("ErrorLog - {0:yyyy-MM-dd hh-mmtt}.txt", DateTime.Now);
string firstLine = string.Format("MatterControl Errors: {0:yyyy-MM-dd hh:mm:ss tt}", DateTime.Now);
using (StreamWriter file = new StreamWriter(errorLogFileName))
{
file.WriteLine(errorLogFileName, firstLine);
}
}
public void RunTests(string[] testCommands)
{
try { ReleaseTests.AssertDebugNotDefined(); }
catch (Exception e) { DumpException(e); }
try { MatterHackers.GCodeVisualizer.GCodeFile.AssertDebugNotDefined(); }
catch (Exception e) { DumpException(e); }
}
void DumpException(Exception e)
{
using (StreamWriter w = File.AppendText(errorLogFileName))
{
w.WriteLine(e.Message);
w.Write(e.StackTrace);
w.WriteLine();
}
}
}
}