Initial import
This commit is contained in:
1 parent
ea3f8549e4
commit
fa6feafba7
133 files changed
+17503
-4
No files matched your search
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using NUnit.Framework;
|
||||
|
||||
using DelphiProjectHandler.LibraryPaths;
|
||||
|
||||
namespace DelphiProjectHandler.Tests.LibraryPaths
|
||||
{
|
||||
[TestFixture]
|
||||
public class ClipboardLibraryPathsProviderTests
|
||||
{
|
||||
protected string cPaths = @"$(DELPHI)\Lib;$(DELPHI)\Bin;$(DELPHI)\Imports;$(DELPHI)\Projects\Bpl;$(DM_VIEW)\Lib;$(DM_TP)\abbrevia\source;$(DM_TP)\TGlobe\SOURCE;$(DM_TP)\AsyncPRO\source;$(DM_TP)\RegExpr\Source;$(DM_TP)\BTrieveSDK;$(DM_TP)\PxLib;$(DM_TP)\ExcMagicD6;$(DM_TP)\JWA\Win32Api;$(DM_TP)\XMLParser;$(DM_TP)\XMLPRO\source;$(DM_TP)\CalcExpress;$(DM_TP)\Indy9;$(DM_VIEW)\I;$(DM_VIEW)\Maps;$(DM_VIEW)\Forms;$(DM_VIEW)\U;$(DM_VIEW)\U\Brokers;$(DM_VIEW)\U\Eram;$(DM_VIEW)\U\FPValidators;$(BASA_DM);$(BASA_DM)\UUtils;$(BASA_DM)\UBtrieve;$(BASA_DM)\UBtrieve\UBroker;$(BASA_DM)\UFacilitator;$(BASA_DM)\USQL\UBroker;$(BASA_DM)\USQL\UOperation;$(BASA_DM)\USQL\UQueryBuilder;$(BASA_DM)\USQL\UUtil;$(BASA_DM)\USQL\UUtil\VersionInfo;$(BASA_DM)\USQLCache;$(BASA_DM)\USQLCache\UOperation;$(BASA_DM)\USQLCache\UUtil;$(BASA_DM)\UStream;$(BASA_DM)\UTransfer;$(BASA_DM)\USQL;$(DM_TP)\FCSUtils;$(DM_TP)\FCSUtils\System;$(DM_TP)\FCSUtils\DateUtils;$(DM_TP)\FCSUtils\DbUtils;$(DM_TP)\FCSUtils\Logging;$(DM_TP)\FCSUtils\Security;$(DM_TP)\FCSUtils\XMLRTTI;$(DM_TP)\ZipMaster;$(DM_TP)\KeyHelp;$(DM_TP)\DelphiKit;$(DM_VIEW)\U\EuroATCPlanValidation;$(DM_VIEW)\U\EuroATCPlanValidation\CFMU;$(DM_TP)\Guggenheim\Dcu;$(DM_TP)\JEDI\JCL\lib\d6;$(DM_TP)\JEDI\JCL\source;$(DM_TP)\JEDI\jvcl\lib\D6;$(DM_TP)\JEDI\jvcl\common;$(DM_TP)\JEDI\jvcl\Resources";
|
||||
|
||||
[Test]
|
||||
[STAThread]
|
||||
public void List()
|
||||
{
|
||||
ILibraryPathsProvider vProvider = new ClipboardLibraryPathsProvider();
|
||||
Clipboard.SetText(cPaths);
|
||||
IList<string> vPaths = vProvider.List();
|
||||
Assert.AreEqual(58, vPaths.Count);
|
||||
Assert.GreaterOrEqual(vPaths.IndexOf(@"$(DELPHI)\Lib"), 0, "Test 1");
|
||||
Assert.GreaterOrEqual(vPaths.IndexOf(@"$(DM_TP)\JEDI\jvcl\Resources"), 0, "Test 2");
|
||||
Assert.AreEqual(-1, vPaths.IndexOf(";"), "Test 3");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
using DelphiProjectHandler.LibraryPaths;
|
||||
|
||||
namespace DelphiProjectHandler.Tests.LibraryPaths
|
||||
{
|
||||
[TestFixture]
|
||||
public class DelphiLibraryPathBuilderTests
|
||||
{
|
||||
[Test]
|
||||
public void Build()
|
||||
{
|
||||
Dictionary<string, string> vEnvironmentStrings = new Dictionary<string, string>();
|
||||
vEnvironmentStrings.Add("BASA_DM", "$(DM_TP)\\Basa");
|
||||
vEnvironmentStrings.Add("DM_TP", "$(DM_VIEW)\\THIRDPARTY");
|
||||
vEnvironmentStrings.Add("DM_VIEW", "d:\\DM\\sg894652_2006.2_ccrc\\dispmgr");
|
||||
vEnvironmentStrings.Add("FCSUtils", "$(DM_TP)\\FcsUtils");
|
||||
vEnvironmentStrings.Add("delphi", "c:\\program files\\borland\\delphi5");
|
||||
|
||||
List<string> vPaths = new List<string>();
|
||||
vPaths.Add("$(DM_View)\\DPR");
|
||||
vPaths.Add("$(DM_TP)\\BASA");
|
||||
vPaths.Add("$(Delphi)\\Lib");
|
||||
vPaths.Add("C:\\source\\dm\\latest");
|
||||
|
||||
ILibraryPathsBuilder vBuilder = new DelphiLibraryPathsBuilder();
|
||||
ICollection<string> vActual = vBuilder.Build(vPaths, vEnvironmentStrings);
|
||||
Assert.AreEqual(4, vActual.Count, "Invalid no. of returned paths");
|
||||
Assert.IsTrue(vActual.Contains(@"d:\dm\sg894652_2006.2_ccrc\dispmgr\dpr"), "Path 0 wasn't found");
|
||||
Assert.IsTrue(vActual.Contains(@"d:\dm\sg894652_2006.2_ccrc\dispmgr\thirdparty\basa"), "Path 1 wasn't found");
|
||||
Assert.IsTrue(vActual.Contains(@"c:\program files\borland\delphi5\lib"), "Path 2 wasn't found");
|
||||
Assert.IsTrue(vActual.Contains(@"c:\source\dm\latest"), "Path 3 wasn't found");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using DelphiProjectHandler.LibraryPaths;
|
||||
|
||||
namespace DelphiProjectHandler.Tests.LibraryPaths
|
||||
{
|
||||
[TestFixture]
|
||||
class DelphiLibraryPathProviderTests
|
||||
{
|
||||
[Test]
|
||||
public void Delphi5Paths()
|
||||
{
|
||||
ILibraryPathsProvider vProvider = new DelphiLibraryPathsProvider(LibraryPathType.Delphi5);
|
||||
IList<string> vLibraryPaths = vProvider.List();
|
||||
Assert.GreaterOrEqual(vLibraryPaths.IndexOf("c:\\program files\\borland\\delphi5\\lib"), 0, "Test 1");
|
||||
Assert.GreaterOrEqual(vLibraryPaths.IndexOf("d:\\dm\\sg894652_5.3_ccrc\\dispmgr\\u"), 0, "Test 2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Delphi6Paths()
|
||||
{
|
||||
ILibraryPathsProvider vProvider = new DelphiLibraryPathsProvider(LibraryPathType.Delphi6);
|
||||
IList<string> vLibraryPaths = vProvider.List();
|
||||
Assert.GreaterOrEqual(vLibraryPaths.IndexOf("c:\\program files\\borland\\delphi6\\lib\\"), 0, "Test 1");
|
||||
// Assert.GreaterOrEqual(vLibraryPaths.IndexOf("d:\\dm\\sg894652_2006.2_ccrc\\dispmgr\\u"), 0, "Test 2");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Created by SharpDevelop.
|
||||
* User: SG0894652
|
||||
* Date: 8/10/2009
|
||||
* Time: 11:21 PM
|
||||
*
|
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
|
||||
using DelphiProjectHandler.LibraryPaths;
|
||||
|
||||
namespace DelphiProjectHandler.Tests.LibraryPaths
|
||||
{
|
||||
[TestFixture]
|
||||
public class DelphiRegistryKeysTests
|
||||
{
|
||||
[Test]
|
||||
public void LibraryKey()
|
||||
{
|
||||
Assert.IsNotNull(DelphiRegistryKeys.LibraryKey(LibraryPathType.Delphi5), "Delphi5 should be created");
|
||||
Assert.IsNotNull(DelphiRegistryKeys.LibraryKey(LibraryPathType.Delphi6), "Delphi5 should be created");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(NotSupportedException))]
|
||||
public void LibraryKey_NotSupported()
|
||||
{
|
||||
DelphiRegistryKeys.LibraryKey(LibraryPathType.Delphi2009);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void RootDirKey()
|
||||
{
|
||||
Assert.IsNotNull(DelphiRegistryKeys.RootDirKey(LibraryPathType.Delphi5), "Delphi5 should be created");
|
||||
Assert.IsNotNull(DelphiRegistryKeys.RootDirKey(LibraryPathType.Delphi6), "Delphi5 should be created");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(NotSupportedException))]
|
||||
public void RootDirKey_NotSupported()
|
||||
{
|
||||
DelphiRegistryKeys.RootDirKey(LibraryPathType.Delphi2009);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EnvironmentPathsKey()
|
||||
{
|
||||
Assert.IsNotNull(DelphiRegistryKeys.EnvironmentPathsKey(LibraryPathType.Delphi6), "Delphi6 should be created");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(NotSupportedException))]
|
||||
public void EnvironmentPathsKey_NotSupported()
|
||||
{
|
||||
DelphiRegistryKeys.EnvironmentPathsKey(LibraryPathType.Delphi5);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NUnit.Framework;
|
||||
|
||||
using DelphiProjectHandler.LibraryPaths;
|
||||
|
||||
namespace DelphiProjectHandler.Tests.LibraryPaths
|
||||
{
|
||||
[TestFixture]
|
||||
public class LibraryPathProviderFactoryTests
|
||||
{
|
||||
protected void TestCreateProvider(LibraryPathType iLibraryType, Type iExpectedType, string iErrorMsg)
|
||||
{
|
||||
ILibraryPathsProvider vProvider = LibraryPathsProviderFactory.CreateProvider(iLibraryType);
|
||||
Assert.IsNotNull(vProvider, "Provider was not created. " + iErrorMsg);
|
||||
Assert.IsInstanceOf(iExpectedType, vProvider, "Created provider is of wrong type. " + iErrorMsg);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateProvider_Supported()
|
||||
{
|
||||
TestCreateProvider(LibraryPathType.Delphi5, typeof(DelphiLibraryPathsProvider), "Test 1");
|
||||
TestCreateProvider(LibraryPathType.Delphi6, typeof(DelphiLibraryPathsProvider), "Test 2");
|
||||
TestCreateProvider(LibraryPathType.Clipboard, typeof(ClipboardLibraryPathsProvider), "Test 3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(NotSupportedException))]
|
||||
public void CreateProvider_NotSupported_Delphi2005()
|
||||
{
|
||||
LibraryPathsProviderFactory.CreateProvider(LibraryPathType.Delphi2005);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(NotSupportedException))]
|
||||
public void CreateProvider_NotSupported_Delphi2007()
|
||||
{
|
||||
LibraryPathsProviderFactory.CreateProvider(LibraryPathType.Delphi2007);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(NotSupportedException))]
|
||||
public void CreateProvider_NotSupported_Delphi7()
|
||||
{
|
||||
LibraryPathsProviderFactory.CreateProvider(LibraryPathType.Delphi7);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ListSupportedProviders()
|
||||
{
|
||||
LibraryPathType[] vSupported = LibraryPathsProviderFactory.ListSupportedProviders();
|
||||
Assert.AreEqual(3, vSupported.Length, "No. of supported providers is wrong");
|
||||
Assert.AreEqual(LibraryPathType.Delphi5, vSupported[0], "Item 0 is wrong");
|
||||
Assert.AreEqual(LibraryPathType.Delphi6, vSupported[1], "Item 1 is wrong");
|
||||
Assert.AreEqual(LibraryPathType.Clipboard, vSupported[2], "Item 2 is wrong");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsProviderSupported_Supported()
|
||||
{
|
||||
Assert.IsTrue(LibraryPathsProviderFactory.IsProviderSupported(LibraryPathType.Delphi5), "Delphi5 should be supported");
|
||||
Assert.IsTrue(LibraryPathsProviderFactory.IsProviderSupported(LibraryPathType.Delphi6), "Delphi6 should be supported");
|
||||
Assert.IsTrue(LibraryPathsProviderFactory.IsProviderSupported(LibraryPathType.Clipboard), "Clipboard should be supported");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsProviderSupported_NotSupported()
|
||||
{
|
||||
Assert.IsFalse(LibraryPathsProviderFactory.IsProviderSupported(LibraryPathType.Delphi7), "Delphi7 should not be supported");
|
||||
Assert.IsFalse(LibraryPathsProviderFactory.IsProviderSupported(LibraryPathType.Delphi2005), "Delphi2005 should not be supported");
|
||||
Assert.IsFalse(LibraryPathsProviderFactory.IsProviderSupported(LibraryPathType.Delphi2007), "Delphi2007 should not be supported");
|
||||
Assert.IsFalse(LibraryPathsProviderFactory.IsProviderSupported(LibraryPathType.Delphi2009), "Delphi2009 should not be supported");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user