private void treeView_MouseDoubleClick(object sender, MouseEventArgs e) { if (treeView.SelectedNode == null || treeView.SelectedNode.Level != 1 || treeView.SelectedNode.Parent.Text != Paths.ScriptFolder && treeView.SelectedNode.Parent.Text != Paths.TestsFolder) { return; } var asset = AssetManager.GetAsset(treeView.SelectedNode.Parent.Text, treeView.SelectedNode.Text); if (asset.HoldsTypeOf(typeof(Script))) { if (!ScriptManager.LoadedScripts.Any(s => s.Name == asset.Name)) { ScriptManager.LoadScript(asset.Path); } } else if (asset.HoldsTypeOf(typeof(LightTestFixture))) { if (!TestFixtureManager.Contains(asset.Name)) { var lightTestFixture = asset.Importer.Load <LightTestFixture>(); if (lightTestFixture != null) { lightTestFixture.Name = asset.Name; var fixture = TestFixtureManager.NewTestFixture(lightTestFixture); fixture.Path = asset.Path; } } // TODO: Send some message to main form to give focus to window is TestFixture is already open } }
public void ReloadScript_UpdatesScriptRef_FromFile() { var script = ScriptManager.LoadedScripts[0]; ScriptManager.SaveScript(script, k_ScriptAPath); script.AddCommand(new CommandSleep(5)); var script2 = ScriptManager.LoadScript(k_ScriptAPath); Assert.AreNotEqual(script, script2, "Reloading script should give new reference type object"); Assert.AreEqual(script2, ScriptManager.LoadedScripts[0], "Scripts from assets and in script manager should be the same"); Assert.AreEqual(0, script2.Commands.Count(), "Script should not have commands"); }