13 changed files with 57 additions and 137 deletions
@ -1,60 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
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 |
|
||||||
"<AddIn name='RubyBinding' author= '' copyright='' description=''>\r\n" + |
|
||||||
" <Manifest>\r\n" + |
|
||||||
" <Identity name='ICSharpCode.RubyBinding'/>\r\n" + |
|
||||||
" </Manifest>\r\n" + |
|
||||||
"</AddIn>"; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,50 +0,0 @@ |
|||||||
// <file>
|
|
||||||
// <copyright see="prj:///doc/copyright.txt"/>
|
|
||||||
// <license see="prj:///doc/license.txt"/>
|
|
||||||
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
|
|
||||||
// <version>$Revision$</version>
|
|
||||||
// </file>
|
|
||||||
|
|
||||||
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); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue