diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Configuration/AddInOptionsTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Configuration/AddInOptionsTestFixture.cs index 754509e8aa..f0fdf7cc0c 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Configuration/AddInOptionsTestFixture.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Configuration/AddInOptionsTestFixture.cs @@ -9,6 +9,7 @@ using System; using System.IO; using ICSharpCode.Core; using ICSharpCode.PythonBinding; +using ICSharpCode.Scripting.Tests.Utils; using NUnit.Framework; using PythonBinding.Tests.Utils; @@ -27,7 +28,8 @@ namespace PythonBinding.Tests.Configuration [TestFixtureSetUp] public void SetUpFixture() { - addin = AddInPathHelper.CreateDummyPythonAddInInsideAddInTree(); + AddInPathHelper helper = new AddInPathHelper("PythonBinding"); + addin = helper.CreateDummyAddInInsideAddInTree(); addin.FileName = @"C:\Projects\SD\AddIns\Python\pythonbinding.addin"; } diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj index 186689c7dc..7a8ebf4515 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/PythonBinding.Tests.csproj @@ -425,7 +425,6 @@ - @@ -443,7 +442,6 @@ - PythonBinding.addin diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestDebuggerRunsSelectedTestMethodTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestDebuggerRunsSelectedTestMethodTestFixture.cs index acaa59b8f7..2362a43060 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestDebuggerRunsSelectedTestMethodTestFixture.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestDebuggerRunsSelectedTestMethodTestFixture.cs @@ -9,8 +9,10 @@ using System; using System.Diagnostics; using System.IO; using System.Text; + using ICSharpCode.Core; using ICSharpCode.PythonBinding; +using ICSharpCode.Scripting.Tests.Utils; using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.UnitTesting; using NUnit.Framework; @@ -110,7 +112,8 @@ namespace PythonBinding.Tests.Testing [Test] public void CommandLineArgumentHasSharpDevelopTestPythonScriptAndResponseFileName() { - AddIn addin = AddInPathHelper.CreateDummyPythonAddInInsideAddInTree(); + AddInPathHelper helper = new AddInPathHelper("PythonBinding"); + AddIn addin = helper.CreateDummyAddInInsideAddInTree(); addin.FileName = @"c:\sharpdevelop\addins\pythonbinding\pythonbinding.addin"; RunTestsOnSelectedTestMethod(); diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerRunsSelectedTestMethodTestFixture.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerRunsSelectedTestMethodTestFixture.cs index b3c4c71b6c..a2d337d638 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerRunsSelectedTestMethodTestFixture.cs +++ b/src/AddIns/BackendBindings/Python/PythonBinding/Test/Testing/PythonTestRunnerRunsSelectedTestMethodTestFixture.cs @@ -9,8 +9,10 @@ using System; using System.Diagnostics; using System.IO; using System.Text; + using ICSharpCode.Core; using ICSharpCode.PythonBinding; +using ICSharpCode.Scripting.Tests.Utils; using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.UnitTesting; @@ -97,7 +99,8 @@ namespace PythonBinding.Tests.Testing [Test] public void CommandLineArgumentHasSharpDevelopTestPythonScriptAndResponseFileName() { - AddIn addin = AddInPathHelper.CreateDummyPythonAddInInsideAddInTree(); + AddInPathHelper helper = new AddInPathHelper("PythonBinding"); + AddIn addin = helper.CreateDummyAddInInsideAddInTree(); addin.FileName = @"c:\sharpdevelop\addins\pythonbinding\pythonbinding.addin"; RunTestsOnSelectedTestMethod(); diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj index 1668769545..3ac501ed33 100644 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj +++ b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/RubyBinding.Tests.csproj @@ -323,7 +323,6 @@ - @@ -340,7 +339,6 @@ - RubyBinding.addin diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestDebuggerRunsSelectedTestMethodTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestDebuggerRunsSelectedTestMethodTestFixture.cs index 6122d6d77b..c12eb9a5a4 100644 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestDebuggerRunsSelectedTestMethodTestFixture.cs +++ b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestDebuggerRunsSelectedTestMethodTestFixture.cs @@ -9,8 +9,10 @@ using System; using System.Diagnostics; using System.IO; using System.Text; + using ICSharpCode.Core; using ICSharpCode.RubyBinding; +using ICSharpCode.Scripting.Tests.Utils; using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.UnitTesting; using NUnit.Framework; @@ -109,7 +111,8 @@ namespace RubyBinding.Tests.Testing [Test] public void CommandLineArgumentHasSharpDevelopTestRubyScriptFileNameAndTestResultsFileNameResponseFileName() { - AddIn addin = AddInPathHelper.CreateDummyRubyAddInInsideAddInTree(); + AddInPathHelper helper = new AddInPathHelper("RubyBinding"); + AddIn addin = helper.CreateDummyAddInInsideAddInTree(); addin.FileName = @"c:\sharpdevelop\addins\rubybinding\rubybinding.addin"; testResultsMonitor.FileName = @"d:\testresults.txt"; diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerApplicationTests.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerApplicationTests.cs index 3e7dcd245f..15776ba036 100644 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerApplicationTests.cs +++ b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerApplicationTests.cs @@ -6,10 +6,12 @@ // using System; -using System.IO; using System.Diagnostics; +using System.IO; + using ICSharpCode.Core; using ICSharpCode.RubyBinding; +using ICSharpCode.Scripting.Tests.Utils; using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Project; using ICSharpCode.UnitTesting; @@ -37,7 +39,8 @@ namespace RubyBinding.Tests.Testing Properties properties = new Properties(); options = new RubyAddInOptions(properties); - AddIn addin = AddInPathHelper.CreateDummyRubyAddInInsideAddInTree(); + AddInPathHelper helper = new AddInPathHelper("RubyBinding"); + AddIn addin = helper.CreateDummyAddInInsideAddInTree(); addin.FileName = @"c:\rubybinding\rubybinding.addin"; string testResultsFileName = "results.txt"; @@ -91,7 +94,8 @@ namespace RubyBinding.Tests.Testing [Test] public void CreateProcessInfoReturnsFixedTestRunnerFilePath() { - AddIn addin = AddInPathHelper.CreateDummyRubyAddInInsideAddInTree(); + AddInPathHelper helper = new AddInPathHelper("RubyBinding"); + AddIn addin = helper.CreateDummyAddInInsideAddInTree(); addin.FileName = @"c:\rubybinding\bin\..\AddIns\rubybinding.addin"; MockCSharpProject project = new MockCSharpProject(); diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerRunsSelectedTestMethodTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerRunsSelectedTestMethodTestFixture.cs index d5470a0741..5ab6cee35b 100644 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerRunsSelectedTestMethodTestFixture.cs +++ b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Testing/RubyTestRunnerRunsSelectedTestMethodTestFixture.cs @@ -9,8 +9,10 @@ using System; using System.Diagnostics; using System.IO; using System.Text; + using ICSharpCode.Core; using ICSharpCode.RubyBinding; +using ICSharpCode.Scripting.Tests.Utils; using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.UnitTesting; @@ -90,7 +92,8 @@ namespace RubyBinding.Tests.Testing [Test] public void CommandLineArgumentHasSharpDevelopTestRubyScriptFileNameAndTestResultsFileNameAndResponseFileName() { - AddIn addin = AddInPathHelper.CreateDummyRubyAddInInsideAddInTree(); + AddInPathHelper helper = new AddInPathHelper("RubyBinding"); + AddIn addin = helper.CreateDummyAddInInsideAddInTree(); addin.FileName = @"c:\sharpdevelop\addins\rubybinding\rubybinding.addin"; testResultsMonitor.FileName = @"d:\testresults.txt"; diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/AddInPathHelper.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/AddInPathHelper.cs deleted file mode 100644 index b3ae4a8434..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/AddInPathHelper.cs +++ /dev/null @@ -1,60 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using System.IO; -using ICSharpCode.Core; - -namespace RubyBinding.Tests.Utils -{ - public static class AddInPathHelper - { - public static AddIn CreateDummyRubyAddInInsideAddInTree() - { - RemoveOldAddIn(); - AddIn addin = CreateAddIn(); - AddInTree.InsertAddIn(addin); - return addin; - } - - static void RemoveOldAddIn() - { - AddIn oldAddin = FindOldAddIn(); - if (oldAddin != null) { - AddInTree.RemoveAddIn(oldAddin); - } - } - - static AddIn FindOldAddIn() - { - foreach (AddIn addin in AddInTree.AddIns) { - if (addin.Manifest.PrimaryIdentity == "ICSharpCode.RubyBinding") { - return addin; - } - } - return null; - } - - static AddIn CreateAddIn() - { - string xml = GetAddInXml(); - AddIn addin = AddIn.Load(new StringReader(xml)); - addin.FileName = @"C:\SharpDevelop\AddIns\RubyBinding\RubyBinding.addin"; - return addin; - } - - static string GetAddInXml() - { - return - "\r\n" + - " \r\n" + - " \r\n" + - " \r\n" + - ""; - } - } -} diff --git a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/Tests/AddInPathHelperTestFixture.cs b/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/Tests/AddInPathHelperTestFixture.cs deleted file mode 100644 index 93047628bc..0000000000 --- a/src/AddIns/BackendBindings/Ruby/RubyBinding/Test/Utils/Tests/AddInPathHelperTestFixture.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// -// -// -// $Revision$ -// - -using System; -using ICSharpCode.Core; -using NUnit.Framework; -using RubyBinding.Tests.Utils; - -namespace RubyBinding.Tests.Utils.Tests -{ - [TestFixture] - public class AddInPathHelperTestFixture - { - AddIn rubyAddIn; - - [SetUp] - public void Init() - { - rubyAddIn = AddInPathHelper.CreateDummyRubyAddInInsideAddInTree(); - } - - [Test] - public void AddInFileNameIsCDriveSharpDevelopAddInsRubyBindingRubyBindingAddIn() - { - string expectedFileName = @"C:\SharpDevelop\AddIns\RubyBinding\RubyBinding.addin"; - Assert.AreEqual(expectedFileName, rubyAddIn.FileName); - } - - [Test] - public void StringParserAddInPathIsCDriveSharpDevelopAddInsRubyBindingForRubyBindingAddIn() - { - string directory = StringParser.Parse("${addinpath:ICSharpCode.RubyBinding}"); - string expectedDirectory = @"C:\SharpDevelop\AddIns\RubyBinding"; - Assert.AreEqual(expectedDirectory, directory); - } - - [Test] - public void ChangingAddInFileNameReturnsExpectedFileNameFromStringParserAddInPath() - { - rubyAddIn.FileName = @"c:\def\pythonbinding.addin"; - string expectedDirectory = @"c:\def"; - string actualDirectory = StringParser.Parse("${addinpath:ICSharpCode.RubyBinding}"); - Assert.AreEqual(expectedDirectory, actualDirectory); - } - } -} diff --git a/src/AddIns/BackendBindings/Scripting/Test/ICSharpCode.Scripting.Tests.csproj b/src/AddIns/BackendBindings/Scripting/Test/ICSharpCode.Scripting.Tests.csproj index a6a9d2f9e0..41c1f30141 100644 --- a/src/AddIns/BackendBindings/Scripting/Test/ICSharpCode.Scripting.Tests.csproj +++ b/src/AddIns/BackendBindings/Scripting/Test/ICSharpCode.Scripting.Tests.csproj @@ -78,6 +78,7 @@ + @@ -118,6 +119,7 @@ + diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/AddInPathHelper.cs b/src/AddIns/BackendBindings/Scripting/Test/Utils/AddInPathHelper.cs similarity index 51% rename from src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/AddInPathHelper.cs rename to src/AddIns/BackendBindings/Scripting/Test/Utils/AddInPathHelper.cs index 3b2722db3c..cbadbdec75 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/AddInPathHelper.cs +++ b/src/AddIns/BackendBindings/Scripting/Test/Utils/AddInPathHelper.cs @@ -9,11 +9,22 @@ using System; using System.IO; using ICSharpCode.Core; -namespace PythonBinding.Tests.Utils +namespace ICSharpCode.Scripting.Tests.Utils { - public static class AddInPathHelper + public class AddInPathHelper { - public static AddIn CreateDummyPythonAddInInsideAddInTree() + string addInName; + string identity; + string fileName; + + public AddInPathHelper(string addInName) + { + this.addInName = addInName; + identity = String.Format("ICSharpCode.{0}", addInName); + fileName = String.Format(@"C:\SharpDevelop\AddIns\{0}\{0}.addin", addInName); + } + + public AddIn CreateDummyAddInInsideAddInTree() { RemoveOldAddIn(); AddIn addin = CreateAddIn(); @@ -21,7 +32,7 @@ namespace PythonBinding.Tests.Utils return addin; } - static void RemoveOldAddIn() + void RemoveOldAddIn() { AddIn oldAddin = FindOldAddIn(); if (oldAddin != null) { @@ -29,32 +40,34 @@ namespace PythonBinding.Tests.Utils } } - static AddIn FindOldAddIn() + AddIn FindOldAddIn() { foreach (AddIn addin in AddInTree.AddIns) { - if (addin.Manifest.PrimaryIdentity == "ICSharpCode.PythonBinding") { + if (addin.Manifest.PrimaryIdentity == identity) { return addin; } } return null; } - static AddIn CreateAddIn() + AddIn CreateAddIn() { string xml = GetAddInXml(); AddIn addin = AddIn.Load(new StringReader(xml)); - addin.FileName = @"C:\SharpDevelop\AddIns\PythonBinding\PythonBinding.addin"; + addin.FileName = fileName; return addin; } - static string GetAddInXml() + string GetAddInXml() { - return - "\r\n" + + string format = + "\r\n" + " \r\n" + - " \r\n" + + " \r\n" + " \r\n" + ""; + + return String.Format(format, addInName, identity); } } } diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/AddInPathHelperTestFixture.cs b/src/AddIns/BackendBindings/Scripting/Test/Utils/Tests/AddInPathHelperTests.cs similarity index 86% rename from src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/AddInPathHelperTestFixture.cs rename to src/AddIns/BackendBindings/Scripting/Test/Utils/Tests/AddInPathHelperTests.cs index ceeb152e46..c97f61914e 100644 --- a/src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/Tests/AddInPathHelperTestFixture.cs +++ b/src/AddIns/BackendBindings/Scripting/Test/Utils/Tests/AddInPathHelperTests.cs @@ -7,10 +7,10 @@ using System; using ICSharpCode.Core; +using ICSharpCode.Scripting.Tests.Utils; using NUnit.Framework; -using PythonBinding.Tests.Utils; -namespace PythonBinding.Tests.Utils.Tests +namespace ICSharpCode.Scripting.Tests.Utils.Tests { [TestFixture] public class AddInPathHelperTestFixture @@ -20,7 +20,8 @@ namespace PythonBinding.Tests.Utils.Tests [SetUp] public void Init() { - pythonAddIn = AddInPathHelper.CreateDummyPythonAddInInsideAddInTree(); + AddInPathHelper helper = new AddInPathHelper("PythonBinding"); + pythonAddIn = helper.CreateDummyAddInInsideAddInTree(); } [Test]