diff --git a/MatterControl.csproj b/MatterControl.csproj
index 63fd2d869..5feec7499 100644
--- a/MatterControl.csproj
+++ b/MatterControl.csproj
@@ -98,6 +98,8 @@
+
+
diff --git a/MatterControlApplication.cs b/MatterControlApplication.cs
index cd27b9f8e..c75aaecda 100644
--- a/MatterControlApplication.cs
+++ b/MatterControlApplication.cs
@@ -71,9 +71,20 @@ namespace MatterHackers.MatterControl
public MatterControlApplication(double width, double height)
: base(width, height)
{
- this.commandLineArgs = Environment.GetCommandLineArgs();;
+ this.commandLineArgs = Environment.GetCommandLineArgs();
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
+ if (commandLineArgs.Length > 1 && commandLineArgs[1].ToUpper() == "TEST")
+ {
+ Testing.TestingDispatch testDispatch = new Testing.TestingDispatch();
+ string[] testCommands = new string[commandLineArgs.Length-2];
+ if (commandLineArgs.Length > 2)
+ {
+ commandLineArgs.CopyTo(testCommands, 2);
+ }
+ testDispatch.RunTests(testCommands);
+ }
+
//WriteTestGCodeFile();
if (File.Exists("RunUnitTests.txt"))
{
diff --git a/Testing/ReleaseTests.cs b/Testing/ReleaseTests.cs
new file mode 100644
index 000000000..cb7a5e367
--- /dev/null
+++ b/Testing/ReleaseTests.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MatterHackers.MatterControl.Testing
+{
+ public static class ReleaseTests
+ {
+ public static void AssertDebugNotDefined()
+ {
+#if DEBUG
+ throw new Exception("DEBUG is defined and should not be!");
+#endif
+ }
+ }
+}
diff --git a/Testing/TestingDispatch.cs b/Testing/TestingDispatch.cs
new file mode 100644
index 000000000..87d499267
--- /dev/null
+++ b/Testing/TestingDispatch.cs
@@ -0,0 +1,42 @@
+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();
+ }
+ }
+ }
+}