diff --git a/xUnitRevit/App.cs b/xUnitRevit/App.cs
index 81878e1..3fc6c3b 100644
--- a/xUnitRevit/App.cs
+++ b/xUnitRevit/App.cs
@@ -26,10 +26,10 @@ namespace xUnitRevit
Application app = sender as Application;
UIApplication uiapp = new UIApplication(app);
-
+ Runner.ReadConfig();
- // uiapp.OpenAndActivateDocument(@"C:\Code\Speckle-Next\SpeckleKitRevit\TestModels\Walls.rvt");
- TestRunner.Launch(uiapp);
+ if(Runner.Config.autoStart)
+ Runner.Launch(uiapp);
}
diff --git a/xUnitRevit/Command.cs b/xUnitRevit/Command.cs
index f972d8f..643a109 100644
--- a/xUnitRevit/Command.cs
+++ b/xUnitRevit/Command.cs
@@ -29,7 +29,7 @@ namespace xUnitRevit
ElementSet elements)
{
UIApplication uiapp = commandData.Application;
- TestRunner.Launch(uiapp);
+ Runner.Launch(uiapp);
return Result.Succeeded;
diff --git a/xUnitRevit/Configuration.cs b/xUnitRevit/Configuration.cs
new file mode 100644
index 0000000..73080e9
--- /dev/null
+++ b/xUnitRevit/Configuration.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace xUnitRevit
+{
+ ///
+ /// Simple configuration file for lazy developers
+ ///
+ public class Configuration
+ {
+ public List startupAssemblies { get; set; } = new List();
+ public bool autoStart { get; set; } = false;
+ }
+}
diff --git a/xUnitRevit/Runner.cs b/xUnitRevit/Runner.cs
new file mode 100644
index 0000000..1aeea16
--- /dev/null
+++ b/xUnitRevit/Runner.cs
@@ -0,0 +1,59 @@
+using Autodesk.Revit.UI;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Xunit.Runner.Wpf;
+using Xunit.Runner.Wpf.ViewModel;
+using xUnitRevitUtils;
+using System.Web.Script.Serialization;
+using System.IO;
+
+namespace xUnitRevit
+{
+ public static class Runner
+ {
+ internal static Configuration Config = new Configuration();
+ internal static void Launch(UIApplication uiapp)
+ {
+ try
+ {
+ var queue = new List();
+ var eventHandler = ExternalEvent.Create(new ExternalEventHandler(queue));
+
+ xru.Initialize(uiapp, SynchronizationContext.Current, eventHandler, queue);
+
+ var main = new MainWindow();
+ main.Title = "xUnit Revit by Speckle";
+
+ //pre-load asssemblies, if you're a lazy developer
+ (main.DataContext as MainViewModel).StartupAssemblies = Config.startupAssemblies;
+ main.Show();
+
+
+ }
+ catch (Exception e)
+ {
+ //fail silently
+ }
+ }
+
+ internal static void ReadConfig()
+ {
+ try
+ {
+ var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
+ var path = Path.Combine(dir, "config.json");
+ JavaScriptSerializer JavaScriptSerializer = new JavaScriptSerializer();
+ var json = File.ReadAllText(path);
+ Config = JavaScriptSerializer.Deserialize(json);
+ }
+ catch
+ {}
+ }
+ }
+
+}
diff --git a/xUnitRevit/TestRunner.cs b/xUnitRevit/TestRunner.cs
deleted file mode 100644
index 627a15d..0000000
--- a/xUnitRevit/TestRunner.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-using Autodesk.Revit.UI;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Xunit.Runner.Wpf;
-using Xunit.Runner.Wpf.ViewModel;
-using xUnitRevitUtils;
-
-namespace xUnitRevit
-{
- public static class TestRunner
- {
- public static void Launch(UIApplication uiapp)
- {
- try
- {
- var queue = new List();
- var eventHandler = ExternalEvent.Create(new ExternalEventHandler(queue));
-
- xru.Initialize(uiapp, SynchronizationContext.Current, eventHandler, queue);
-
- var main = new MainWindow();
- main.Title = "xUnit Revit by Speckle";
- /// (main.DataContext as MainViewModel).Injector =
- (main.DataContext as MainViewModel).StartupAssemblies = new List() { @"C:\Code\Speckle-Next\SpeckleKitRevit\SpeckleRevitTests\bin\Debug\SpeckleRevitTests.dll" };
- main.Show();
-
-
- }
- catch (Exception e)
- {
- }
-
- //return Result.Succeeded;
- }
- }
-
- //public class Injector : IAssemblyInjector
- //{
- // private UIApplication uiapp { get; set; }
- // SynchronizationContext uiContext { get; set; }
-
- // private List queue { get; set; }
- // private ExternalEvent eventHandler { get; set; }
-
- // public Injector(UIApplication uiapp, SynchronizationContext uiContext, ExternalEvent eventHandler, List queue)
- // {
- // this.uiapp = uiapp;
- // this.uiContext = uiContext;
- // this.eventHandler = eventHandler;
- // this.queue = queue;
- // }
- // public void Inject(Assembly assembly)
- // {
- // var types = assembly.GetTypes();
- // foreach (var type in types)
- // {
- // if (type.Name == "xru")
- // {
- // if (type.GetProperties().Select(p => p.Name).Contains("Uiapp"))
- // {
- // type.GetProperty("Uiapp").SetValue(null, uiapp);
- // type.GetProperty("UiContext").SetValue(null, uiContext);
- // type.GetProperty("Queue").SetValue(null, queue);
- // type.GetProperty("EventHandler").SetValue(null, eventHandler);
- // }
- // }
- // }
- // }
-
- //}
-}
diff --git a/xUnitRevit/app.config b/xUnitRevit/app.config
new file mode 100644
index 0000000..ef4b6e7
--- /dev/null
+++ b/xUnitRevit/app.config
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/xUnitRevit/config.json b/xUnitRevit/config.json
new file mode 100644
index 0000000..c3afb53
--- /dev/null
+++ b/xUnitRevit/config.json
@@ -0,0 +1,6 @@
+{
+ "startupAssemblies": [
+ "C:\\Code\\Speckle-Next\\SpeckleKitRevit\\SpeckleRevitTests\\bin\\Debug\\SpeckleRevitTests.dll"
+ ],
+ "autoStart": true
+}
\ No newline at end of file
diff --git a/xUnitRevit/xUnitRevit.csproj b/xUnitRevit/xUnitRevit.csproj
index 553eea5..de1057d 100644
--- a/xUnitRevit/xUnitRevit.csproj
+++ b/xUnitRevit/xUnitRevit.csproj
@@ -55,17 +55,24 @@
False
+
+
-
+
+
+
+ Always
+
+
diff --git a/xunit.runner.wpf b/xunit.runner.wpf
index 2365885..8041093 160000
--- a/xunit.runner.wpf
+++ b/xunit.runner.wpf
@@ -1 +1 @@
-Subproject commit 2365885ffafdec783afb2efe3aa003465990c246
+Subproject commit 8041093761a2d7e3ecb052d4edee18ce8bac055b