[sword-svn] r3199 - in trunk/bindings/csharp: . examples tests

scribe at crosswire.org scribe at crosswire.org
Sun Apr 27 21:40:50 MST 2014


Author: scribe
Date: 2014-04-27 21:40:50 -0700 (Sun, 27 Apr 2014)
New Revision: 3199

Added:
   trunk/bindings/csharp/examples/
   trunk/bindings/csharp/examples/LookupExample.cs
   trunk/bindings/csharp/examples/LookupExample.exe
   trunk/bindings/csharp/examples/Makefile
   trunk/bindings/csharp/tests/
   trunk/bindings/csharp/tests/InstallManagerTests.cs
   trunk/bindings/csharp/tests/ManagerTests.cs
   trunk/bindings/csharp/tests/ModuleTests.cs
   trunk/bindings/csharp/tests/Sword.Tests.csproj
Removed:
   trunk/bindings/csharp/FlatApiLookup.cs
   trunk/bindings/csharp/InstallManagerTests.cs
   trunk/bindings/csharp/ManagerTests.cs
   trunk/bindings/csharp/ModuleTests.cs
   trunk/bindings/csharp/Sword.Tests.csproj
Modified:
   trunk/bindings/csharp/AssemblyInfo.cs
   trunk/bindings/csharp/Module.cs
Log:
rearranged csharp stuff, normalized RenderText name, fixed double
content for AssemblyInfo.cs

Modified: trunk/bindings/csharp/AssemblyInfo.cs
===================================================================
--- trunk/bindings/csharp/AssemblyInfo.cs	2014-04-28 02:54:13 UTC (rev 3198)
+++ trunk/bindings/csharp/AssemblyInfo.cs	2014-04-28 04:40:50 UTC (rev 3199)
@@ -38,43 +38,3 @@
 //[assembly: AssemblyDelaySign(false)]
 //[assembly: AssemblyKeyFile("")]
 
-// Copyright 2014  CrossWire Bible Society (http://www.crosswire.org)
-//  	CrossWire Bible Society
-//  	P. O. Box 2528
-//  	Tempe, AZ  85280-2528
-//  
-//  This program is free software; you can redistribute it and/or modify it
-//  under the terms of the GNU General Public License as published by the
-//  Free Software Foundation version 2.
-//  
-//  This program is distributed in the hope that it will be useful, but
-//  WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  General Public License for more details.
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-// Information about this assembly is defined by the following attributes. 
-// Change them to the values specific to your project.
-
-[assembly: AssemblyTitle("Sword")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("")]
-[assembly: AssemblyCopyright("daniel")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
-// The form "{Major}.{Minor}.*" will automatically update the build and revision,
-// and "{Major}.{Minor}.{Build}.*" will update just the revision.
-
-[assembly: AssemblyVersion("1.0.*")]
-
-// The following attributes are used to specify the signing key for the assembly, 
-// if desired. See the Mono documentation for more information about signing.
-
-//[assembly: AssemblyDelaySign(false)]
-//[assembly: AssemblyKeyFile("")]
-

Deleted: trunk/bindings/csharp/FlatApiLookup.cs
===================================================================
--- trunk/bindings/csharp/FlatApiLookup.cs	2014-04-28 02:54:13 UTC (rev 3198)
+++ trunk/bindings/csharp/FlatApiLookup.cs	2014-04-28 04:40:50 UTC (rev 3199)
@@ -1,99 +0,0 @@
-// Copyright 2014  CrossWire Bible Society (http://www.crosswire.org)
-//  	CrossWire Bible Society
-//  	P. O. Box 2528
-//  	Tempe, AZ  85280-2528
-//  
-//  This program is free software; you can redistribute it and/or modify it
-//  under the terms of the GNU General Public License as published by the
-//  Free Software Foundation version 2.
-//  
-//  This program is distributed in the hope that it will be useful, but
-//  WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  General Public License for more details.
-using System;
-
-namespace Sword.Tests
-{
-	class FlatApiLookup
-	{
-		public static void Main (string[] args)
-		{	
-			using(var manager = new Manager())
-			{
-				var module = manager.GetModuleByName(args[0]);
-				
-				if (module == null) 
-				{
-					Console.Error.WriteLine("Could not find module {0}.  Available modules:", args[0]);
-					foreach(var modInfo in manager.GetModInfoList())
-					{
-						Console.WriteLine ("{0}\t - {1}", modInfo.Name, modInfo.Description);
-					}
-					return;
-				}
-				foreach(var locale in manager.AvailableLocales)
-				{
-					Console.WriteLine (locale);	
-				}
-			}
-		}
-		
-		public static void Search()
-		{
-			using(var manager = new Manager())
-			{
-				var module = manager.GetModuleByName("ESV");
-				
-				if (module == null) 
-				{
-					Console.Error.WriteLine("Could not find module {0}.  Available modules:", "ESV");
-					foreach(var modInfo in manager.GetModInfoList())
-					{
-						Console.WriteLine ("{0}\t - {1}", modInfo.Name, modInfo.Description);
-					}
-					return;
-				}
-				
-				foreach(var hit in module.Search("sin", SearchType.REGEX, 0, null))
-				{
-					Console.WriteLine(hit.Key); 
-				}
-				module.TerminateSearch();
-			}
-		}
-		
-		public static void ParseKeyList()
-		{
-			using(var manager = new Manager())
-			{
-				var module = manager.GetModuleByName("ESV");
-				
-				if (module == null) 
-				{
-					Console.Error.WriteLine("Could not find module {0}.  Available modules:", "ESV");
-					foreach(var modInfo in manager.GetModInfoList())
-					{
-						Console.WriteLine ("{0}\t - {1}", modInfo.Name, modInfo.Description);
-					}
-					return;
-				}
-				 
-				module.KeyText = "jn.3.16";
-				
-				Console.WriteLine("==Render=Entry============");
-				Console.WriteLine(module.KeyText);
-				Console.WriteLine("RenderText: " + module.Rendertext());
-				Console.WriteLine("StripText: " + module.StripText());
-				
-				Console.WriteLine("RawText: " + module.RawEntry);
-				Console.WriteLine("=========================="); 
-				
-				foreach(var key in module.ParseKeyList("James 1:19-30"))
-				{
-					Console.WriteLine (key);	
-				}
-			}
-		}
-	}
-}
\ No newline at end of file

Deleted: trunk/bindings/csharp/InstallManagerTests.cs
===================================================================
--- trunk/bindings/csharp/InstallManagerTests.cs	2014-04-28 02:54:13 UTC (rev 3198)
+++ trunk/bindings/csharp/InstallManagerTests.cs	2014-04-28 04:40:50 UTC (rev 3199)
@@ -1,132 +0,0 @@
-// Copyright 2014  CrossWire Bible Society (http://www.crosswire.org)
-//  	CrossWire Bible Society
-//  	P. O. Box 2528
-//  	Tempe, AZ  85280-2528
-//  
-//  This program is free software; you can redistribute it and/or modify it
-//  under the terms of the GNU General Public License as published by the
-//  Free Software Foundation version 2.
-//  
-//  This program is distributed in the hope that it will be useful, but
-//  WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  General Public License for more details.
-using System;
-using NUnit.Framework;
-using System.Linq;
-
-namespace Sword.Tests
-{
-	[TestFixture]
-	public class InstallManagerTests
-	{
-		InstallManager _installManager;
-		
-		[SetUp]
-		public void Setup()
-		{
-			_installManager = new InstallManager("baseDirectory");
-		}
-		
-		[TearDown]
-		public void TearDown()
-		{
-			_installManager.Dispose();
-		}
-		
-		[Test]
-		public void SetUserDisclaimerConfirmed_Called_DoesntCrash()
-		{
-			_installManager.SetUserDisclaimerConfirmed();
-		}
-		
-		[Test]
-		public void SyncConfig_UserDisclaimerConfirmed_ReturnsTrue()
-		{
-			//arrange
-			_installManager.SetUserDisclaimerConfirmed();
-			
-			//act
-			bool result = _installManager.SyncConfig();
-			
-			//assert
-			Assert.That (result, Is.True);
-		}
-		
-		[Test]
-		public void SyncConfig_UserDisclaimerNotConfirmed_ReturnsFalse()
-		{
-			//act
-			bool result = _installManager.SyncConfig();
-			
-			//assert
-			Assert.That (result, Is.False);
-		}
-		
-		[Test]
-		public void RemoteSources_Called_ReturnsRemoteSources()
-		{
-			//arrange
-			_installManager.SetUserDisclaimerConfirmed();
-			_installManager.SyncConfig();
-			
-			//act
-			var remoteSources = _installManager.RemoteSources.ToArray();
-			
-			//assert
-			Assert.That (remoteSources.Length > 0);
-		}
-		
-		[Test]
-		public void RefreshRemoteSource_Called_ReturnsTrue()
-		{
-			//arrange
-			_installManager.SetUserDisclaimerConfirmed();
-			_installManager.SyncConfig();
-			string firstSource =  _installManager.RemoteSources.First();
-			bool result = _installManager.RefreshRemoteSource(firstSource);
-			
-			//act
-			Assert.That (result, Is.True);
-		}
-		
-		[Test]
-		public void GetRemoteModInfoList_FirstSource_ReturnsModInfoList()
-		{
-			//arrange
-			_installManager.SetUserDisclaimerConfirmed();
-			_installManager.SyncConfig();
-			string firstSource =  _installManager.RemoteSources.First();
-			_installManager.RefreshRemoteSource(firstSource);
-			
-			ModInfo[] remoteModInfos;
-			using(Manager manager = new Manager())
-			{
-				//act
-				remoteModInfos = _installManager.GetRemoteModInfoList(manager, firstSource).ToArray();
-			}
-			
-			//assert
-			Assert.That (remoteModInfos.Length, Is.GreaterThan(0));
-		}
-		
-		[Test]
-		public void RemoteInstallModule_KJV_ReturnsTrue()
-		{
-			//arrange
-			_installManager.SetUserDisclaimerConfirmed();
-			Assert.That (_installManager.SyncConfig(), Is.True);
-			Assert.That (_installManager.RefreshRemoteSource("CrossWire"), Is.True);
-			
-			using(Manager manager = new Manager("LocalManager"))
-			{
-				//act
-				bool result = _installManager.RemoteInstallModule(manager, "CrossWire", "KJV");
-				
-				//assert
-				Assert.That (result, Is.True);
-			}
-		}
-	}
-}
-

Deleted: trunk/bindings/csharp/ManagerTests.cs
===================================================================
--- trunk/bindings/csharp/ManagerTests.cs	2014-04-28 02:54:13 UTC (rev 3198)
+++ trunk/bindings/csharp/ManagerTests.cs	2014-04-28 04:40:50 UTC (rev 3199)
@@ -1,111 +0,0 @@
-// Copyright 2014  CrossWire Bible Society (http://www.crosswire.org)
-//  	CrossWire Bible Society
-//  	P. O. Box 2528
-//  	Tempe, AZ  85280-2528
-//  
-//  This program is free software; you can redistribute it and/or modify it
-//  under the terms of the GNU General Public License as published by the
-//  Free Software Foundation version 2.
-//  
-//  This program is distributed in the hope that it will be useful, but
-//  WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  General Public License for more details.
-using System;
-using NUnit.Framework;
-using System.IO;
-using System.Linq;
-
-namespace Sword.Tests
-{
-	[TestFixture]
-	public class ManagerTests
-	{
-		Manager _manager;
-		
-		[TestFixtureSetUp]
-		public void Setup()
-		{
-			_manager = new Manager();
-		}
-		
-		[TestFixtureTearDown]
-		public void TearDown()
-		{
-			_manager.Dispose();	
-		}
-		
-		[Test]
-		public void Version_Get_ReturnsAVersion()
-		{
-			//act
-			string swordVersion = _manager.Version;
-			
-			//assert
-			Version version;
-			Assert.That (Version.TryParse(swordVersion, out version));
-		}
-		
-		[Test]
-		public void PrefixPath_Get_ReturnsValidPath()
-		{
-			//act
-			string prefixPath = _manager.PrefixPath;
-			
-			//assert
-			Assert.That (Directory.Exists(prefixPath), Is.True);
-		}
-		
-		[Test]
-		public void ConfigPath_Get_ReturnsValidPath()
-		{
-			//act
-			string configPath = _manager.ConfigPath;
-			
-			//assert
-			Assert.That (Directory.Exists(configPath), Is.True);
-		}
-		
-		[Test]
-		public void SetCipherKey_Called_DoesntCrash()
-		{
-			//act
-			_manager.SetCipherKey("ESV", new byte[32]);
-		}
-		
-		[Test]
-		public void Javascript_Set_DoesntCrash()
-		{
-			//act
-			_manager.Javascript = true;
-		}
-		
-		[Test]
-		public void AvailableLocales_Get_DoesntCrash()
-		{
-			//act
-			var availableLocales = _manager.AvailableLocales.ToArray();
-			
-			//Assert
-			Assert.That (availableLocales[0].Contains("en"));
-		}
-		
-		[Test]
-		public void DefaultLocale_SetToEn_DoesntCrash()
-		{
-			//act
-			_manager.DefaultLocale = "en";
-		}
-		
-		[Test]
-		public void Translate_EnglishToEnglish_ReturnsOrginal()
-		{
-			//act
-			var result = _manager.Translate("love", "en");
-				
-			//assert
-			Assert.That (result, Is.EqualTo("love"));
-		}
-	}
-}
-

Modified: trunk/bindings/csharp/Module.cs
===================================================================
--- trunk/bindings/csharp/Module.cs	2014-04-28 02:54:13 UTC (rev 3198)
+++ trunk/bindings/csharp/Module.cs	2014-04-28 04:40:50 UTC (rev 3199)
@@ -74,7 +74,7 @@
 			}
 		}
 		
-		public string Rendertext()
+		public string RenderText()
 		{
 			IntPtr keyTextPtr = NativeMethods.org_crosswire_sword_SWModule_renderText(_handle);
 			return Marshal.PtrToStringAnsi(keyTextPtr);

Deleted: trunk/bindings/csharp/ModuleTests.cs
===================================================================
--- trunk/bindings/csharp/ModuleTests.cs	2014-04-28 02:54:13 UTC (rev 3198)
+++ trunk/bindings/csharp/ModuleTests.cs	2014-04-28 04:40:50 UTC (rev 3199)
@@ -1,162 +0,0 @@
-// Copyright 2014  CrossWire Bible Society (http://www.crosswire.org)
-//  	CrossWire Bible Society
-//  	P. O. Box 2528
-//  	Tempe, AZ  85280-2528
-//  
-//  This program is free software; you can redistribute it and/or modify it
-//  under the terms of the GNU General Public License as published by the
-//  Free Software Foundation version 2.
-//  
-//  This program is distributed in the hope that it will be useful, but
-//  WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  General Public License for more details.
-using System;
-using NUnit.Framework;
-using System.IO;
-
-namespace Sword.Tests
-{
-	[TestFixture]
-	public class ModuleTests
-	{
-		Module _swordModule;
-		Manager _swordManager;
-		
-		[TestFixtureSetUp]
-		public void Setup()
-		{
-			_swordManager = new Manager("LocalManager");
-			_swordModule = _swordManager.GetModuleByName("ESV");
-			
-			if(_swordModule != null)
-			{
-				return;	
-			}
-			using(var installManager = new InstallManager("baseDirectory"))
-			{
-				installManager.SetUserDisclaimerConfirmed();
-				installManager.SyncConfig();
-				installManager.RefreshRemoteSource("CrossWire");
-			
-				installManager.RemoteInstallModule(_swordManager, "CrossWire", "ESV");
-				_swordModule = _swordManager.GetModuleByName("ESV");
-			}
-		}
-		
-		[TestFixtureTearDown]
-		public void TearDown()
-		{
-			_swordManager.Dispose();
-		}
-		
-		[Test]
-		public void Name_Get_Esv()
-		{
-			//arrange
-			//act
-			string name =_swordModule.Name;
-			
-			//assert
-			Assert.That (name, Is.EqualTo ("ESV"));
-		}
-		
-		[Test]
-		public void Description_Get_DescriptionCorrect()
-		{
-			//arrange
-			//act
-			string description =_swordModule.Description;
-			
-			//assert
-			Assert.That (description, Is.EqualTo ("English Standard Version"));
-		}
-		
-		[Test]
-		public void Catagory_Get_CatagoryCorrect()
-		{
-			//arrange
-			//act
-			string catagory =_swordModule.Category;
-			
-			//assert
-			Assert.That (catagory, Is.EqualTo ("Biblical Texts"));
-		}
-		
-		[Test]
-		public void Previous_John3v16_John3v15()
-		{
-			//arrange
-			_swordModule.KeyText = "jn.3.16";
-			
-			//act
-			_swordModule.Prevous();
-			
-			//assert
-			Assert.That (_swordModule.KeyText, Is.EqualTo( "John 3:15"));
-		}
-		
-		[Test]
-		public void Next_John3v15_John3v16()
-		{
-			//arrange
-			_swordModule.KeyText = "jn.3.15";
-			
-			//act
-			_swordModule.Next();
-			
-			//assert
-			Assert.That (_swordModule.KeyText, Is.EqualTo( "John 3:16"));
-		}
-		
-		[Test]
-		public void Begin_John3v15_Genesis1v1()
-		{
-			//arrange
-			_swordModule.KeyText = "jn.3.15";
-			
-			//act
-			_swordModule.Begin();
-			
-			//assert
-			Assert.That (_swordModule.KeyText, Is.EqualTo( "Genesis 1:1"));
-		}
-		
-		[Test]
-		public void RenderHeader_John3v16_ReturnsNonNullOrEmpty()
-		{
-			//arrange
-			_swordModule.KeyText = "jn.3.16";
-			
-			//act
-			string header = _swordModule.RenderHeader;
-			
-			//assert
-			Assert.That (!string.IsNullOrEmpty(header));
-		}
-		
-		[Test]
-		public void RawEntry_Get_ContainsVerse()
-		{
-			//arrange
-			_swordModule.KeyText = "jn.3.16";
-
-			//act
-			string rawEntry = _swordModule.RawEntry;
-			
-			//assert
-			Assert.That (rawEntry.Contains ("God so loved"));
-		}
-		
-		public void HasSearchFramework_Doesnt_ReturnsFalse()
-		{
-			//arrange
-			//act
-			bool hasSearchFramework = _swordModule.HasSearchFramework();
-			
-			//assert
-			Assert.That (hasSearchFramework, Is.False);
-		}
-	}
-}
-

Deleted: trunk/bindings/csharp/Sword.Tests.csproj
===================================================================
--- trunk/bindings/csharp/Sword.Tests.csproj	2014-04-28 02:54:13 UTC (rev 3198)
+++ trunk/bindings/csharp/Sword.Tests.csproj	2014-04-28 04:40:50 UTC (rev 3199)
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>10.0.0</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{72212684-1186-4F68-8FBD-BDBFDB8CC9BC}</ProjectGuid>
-    <OutputType>Exe</OutputType>
-    <RootNamespace>Sword.Tests</RootNamespace>
-    <AssemblyName>CSSword.Tests</AssemblyName>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG;</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-    <Commandlineparameters>ESV jn.3.16</Commandlineparameters>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>none</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Release</OutputPath>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <Externalconsole>true</Externalconsole>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="nunit.core, Version=2.5.10.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
-      <Private>False</Private>
-      <Package>mono-nunit</Package>
-    </Reference>
-    <Reference Include="nunit.framework, Version=2.5.10.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
-      <Private>False</Private>
-      <Package>mono-nunit</Package>
-    </Reference>
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="AssemblyInfo.cs" />
-    <Compile Include="FlatApiLookup.cs" />
-    <Compile Include="ModuleTests.cs" />
-    <Compile Include="ManagerTests.cs" />
-    <Compile Include="InstallManagerTests.cs" />
-  </ItemGroup>
-  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
-  <ItemGroup>
-    <ProjectReference Include="..\Sword\Sword.csproj">
-      <Project>{EFEE3557-86F2-4E46-AF7E-8BADEE240764}</Project>
-      <Name>Sword</Name>
-    </ProjectReference>
-  </ItemGroup>
-</Project>
\ No newline at end of file

Copied: trunk/bindings/csharp/examples/LookupExample.cs (from rev 3198, trunk/bindings/csharp/FlatApiLookup.cs)
===================================================================
--- trunk/bindings/csharp/examples/LookupExample.cs	                        (rev 0)
+++ trunk/bindings/csharp/examples/LookupExample.cs	2014-04-28 04:40:50 UTC (rev 3199)
@@ -0,0 +1,117 @@
+// Copyright 2014  CrossWire Bible Society (http://www.crosswire.org)
+//  	CrossWire Bible Society
+//  	P. O. Box 2528
+//  	Tempe, AZ  85280-2528
+//  
+//  This program is free software; you can redistribute it and/or modify it
+//  under the terms of the GNU General Public License as published by the
+//  Free Software Foundation version 2.
+//  
+//  This program is distributed in the hope that it will be useful, but
+//  WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  General Public License for more details.
+using System;
+
+namespace Sword.Tests
+{
+	class LookupExample
+	{
+		public static void Main (string[] args)
+		{	
+			if (args.Length != 2)
+			{
+				Console.WriteLine ("usage: lookup <module> <key>");
+				return;
+			}
+			Lookup(args[0], args[1]);
+			return;
+		}
+		
+		public static void Lookup(string modName, string key)
+		{
+			using(var manager = new Manager())
+			{
+				var module = manager.GetModuleByName(modName);
+				
+				if (module == null) 
+				{
+					Console.Error.WriteLine("Could not find module {0}.  Available modules:", modName);
+					foreach(var modInfo in manager.GetModInfoList())
+					{
+						Console.WriteLine ("{0}\t - {1}", modInfo.Name, modInfo.Description);
+					}
+					return;
+				}
+				 
+				module.KeyText = key;
+				
+				Console.WriteLine(module.KeyText);
+				Console.WriteLine("==Raw=Entry============");
+				Console.WriteLine(module.RawEntry);
+				Console.WriteLine("==Render=Text============");
+				Console.WriteLine(module.RenderText());
+				Console.WriteLine("==Strip=Text============");
+				Console.WriteLine(module.StripText());
+				Console.WriteLine("=========================="); 
+			}
+		}
+
+		public static void ParseKeyList()
+		{
+			using(var manager = new Manager())
+			{
+				var module = manager.GetModuleByName("ESV");
+				
+				if (module == null) 
+				{
+					Console.Error.WriteLine("Could not find module {0}.  Available modules:", "ESV");
+					foreach(var modInfo in manager.GetModInfoList())
+					{
+						Console.WriteLine ("{0}\t - {1}", modInfo.Name, modInfo.Description);
+					}
+					return;
+				}
+				 
+				module.KeyText = "jn.3.16";
+				
+				Console.WriteLine("==Render=Entry============");
+				Console.WriteLine(module.KeyText);
+				Console.WriteLine("RenderText: " + module.RenderText());
+				Console.WriteLine("StripText: " + module.StripText());
+				
+				Console.WriteLine("RawText: " + module.RawEntry);
+				Console.WriteLine("=========================="); 
+				
+				foreach(var key in module.ParseKeyList("James 1:19-30"))
+				{
+					Console.WriteLine (key);	
+				}
+			}
+		}
+		
+		public static void Search()
+		{
+			using(var manager = new Manager())
+			{
+				var module = manager.GetModuleByName("ESV");
+				
+				if (module == null) 
+				{
+					Console.Error.WriteLine("Could not find module {0}.  Available modules:", "ESV");
+					foreach(var modInfo in manager.GetModInfoList())
+					{
+						Console.WriteLine ("{0}\t - {1}", modInfo.Name, modInfo.Description);
+					}
+					return;
+				}
+				
+				foreach(var hit in module.Search("sin", SearchType.REGEX, 0, null))
+				{
+					Console.WriteLine(hit.Key); 
+				}
+				module.TerminateSearch();
+			}
+		}
+	}
+}

Added: trunk/bindings/csharp/examples/LookupExample.exe
===================================================================
--- trunk/bindings/csharp/examples/LookupExample.exe	                        (rev 0)
+++ trunk/bindings/csharp/examples/LookupExample.exe	2014-04-28 04:40:50 UTC (rev 3199)
@@ -0,0 +1,279 @@
+MZ       ÿÿ  ¸       @                                   €   º ´	Í!¸LÍ!This program cannot be run in DOS mode.
+
+$       PE  L ¥Ø]S        à   @                  `    @                                                                  O    `  (                   €                                                                   d   H           .text   ¨?       @                    `.rsrc   (   `      B              @  @.reloc      €      F              @  B                ÿ% @           @       Z           N                            _CorExeMain mscoree.dll @         H     D1  d.       @1                                                                                                             (  
+*‚Ži;   r  p(  
+*šš(  *   0$ ä     s  
+o  :b   (  
+r;  po  
+o  o  
+8   o  
+
+r™  p{
+  {  (  
+o  
+:ÖÿÿÿÝ
+   9   o	  
+ÜÝm   o%  o$  (  
+r¯  p(  
+o'  (  
+rß  p(  
+o&  (  
+r p(  
+o)  (  
+rE p(  
+Ý
+   9   o	  
+Ü*A4     0   4   d   
+             Ð   Ö   
+       00 A    s  
+r{ po  :f   (  
+r;  pr{ po  
+o  o  
+8   o  
+
+r™  p{
+  {  (  
+o  
+:ÖÿÿÿÝ
+   9   o	  
+ÜÝÂ   rƒ po%  r“ p(  
+o$  (  
+rÉ po&  (
+  
+(  
+rã po)  (
+  
+(  
+rû po'  (
+  
+(  
+rE p(  
+r po/  o  
+8   o  
+(  
+o  
+:äÿÿÿÝ   9   o	  
+ÜÝ
+   9   o	  
+Ü*   AL     ù   &               8   4   l   
+             -  3  
+       0! ç     s  
+r{ po  :f   (  
+r;  pr{ po  
+o  o  
+8   o  
+
+r™  p{
+  {  (  
+o  
+:ÖÿÿÿÝ
+   9   o	  
+ÜÝh   r+ pjo*  o
+  
+8   o  
+(;  (  
+o  
+:ßÿÿÿÝ   9   o	  
+Üo+  Ý
+   9   o	  
+Ü* AL     ”   +   ¿             8   4   l   
+             Ó   Ù   
+       b(  
+~  
+(f  }  *   2{  (g  *   0      {  (h  
+:   8   *  0      {  (i  
+(n  * 0      {  (k  
+:   8   * 0      {  o  (j  
+(o  *  0 "     {  o  (l  
+:   8   *  0 '       9    {  ~  
+(  
+9   {  (m  * 6(
+  (  
+*  J(  
+(=  }  * N(  
+(>  }  *{  *Ê9+   {  ~  
+(  
+9   {  (D  ~  
+}  * 0 &     {  (?  
+~  
+(  
+9   *s   *  0      sp  
+}  %þ}  * 0      {  ([  
+(  
+* 0      {  (\  
+(  
+* 0      {  (]  
+(  
+* :{  (^  * 0      {  (_  
+(n  *:{  (`  * 6{  (a  *  0      {  (b  
+(n  * 6{  (c  *  0      {  (d  
+(  
+*   6(  (  
+*  :(  
+}  * 0      {  (P  
+(  
+* 0      {  (Q  
+(  
+* 0      {  (R  
+(  
+* 0      {  (C  
+(  
+* 6{  (@  *  0      {  (A  
+(  
+* 0      {  (B  
+(  
+* 6{  (G  *  0      {  (F  
+(  
+* 0 Q     sx  
+}  }  }  }  }  }   }!  }"  }#  %þ}  *   2{  (H  *   2{  (I  *   2{  (J  *   0      {  (K  
+(n  *0      {  (L  
+(n  *0      {  (N  
+@   8   * 0      {  (O  
+(n  * 0      {  (O  
+(  
+* 2{  (T  *   2{  (U  *   2{  (V  *   0      {  (W  
+(  
+* 0      {  (X  
+(  
+*2{  (Y  *   2{  (Z  *   F{  ~  
+(  
+*  0 #       {  ~  
+(  
+9   *{  (  
+* 0 #       {  ~  
+(  
+9   *{  (  
+* 0    	  s€  
+}$  })  %þ}'  *  0    
+  sˆ  
+}*  }.  %þ},  *  (  
+*{  *2{  Œ  *   (t  *0 (     |  þ(  
+þ3*sp  
+{  }  *0 Ö     {  
+}  E      X   8±   {  {  (E  }  {  Ð  (  
+(  
+¥  }  8_   {  }  }  8`   |  (  
+Ð  (  
+(  
+jXs  
+}  {  Ð  (  
+(  
+¥  }  |  {
+  :‘ÿÿÿ}  **  "}  *   s  
+z (  
+*{  *2{  Œ  *   (|  *0 X     |  þ(  
+þ3*sx  
+{#  }#  {  }  {   }  {!  }  {"  }  *0
+ ó     {  
+}  E      u   8Î   {#  {  {  {  {  {  ~  
+(M  }  {  Ð  (  
+(  
+¥  }  8_   {  }  }  8`   |  (  
+Ð  (  
+(  
+jXs  
+}  {  Ð  (  
+(  
+¥  }  |  (:  9‘ÿÿÿ}  ** "}  *   s  
+z (  
+*{(  *{(  *(„  *0 (   	  |'  þ(  
+þ3*s€  
+{)  }$  *0 Ñ     {'  
+}'  E      x   8¬   {$  ~  
+(  
+9   8’   8q   {$  (  
+}%  {%  ~  
+(  
+9   8b   {%  (  
+}&  {&  }(  }'  8;   |$  (  
+(  
+jXs  
+}$  {$  ~  
+(  
+:zÿÿÿ}'  **   "}'  *   s  
+z (  
+*{-  *2{-  Π *   (Π *0 (   
+  |,  þ(  
+þ3*sˆ  
+{.  }*  *0 À     {,  
+},  E      B   8›   {*  Ð  (  
+(  
+¥  }+  8_   {+  }-  },  8`   |*  (  
+Ð  (  
+(  
+jXs  
+}*  {*  Ð  (  
+(  
+¥  }+  |+  {
+  :‘ÿÿÿ},  **"},  *   s  
+z     BSJB         v2.0.50727     p   x  #~  è  4  #Strings    )  4  #US P+    #Blob   T.     #GUID             W¢	             
+   .      t      *      $                        1                    
+      0 ;  O ]  x ]    ¬  È   Ü   ê      R^   „  Æ  í  "  S¬  à÷ 	÷ &÷ E÷ ^÷ w÷ ’÷ ­Ë ë Ë    þ         ð     +%     :%     B%      I%A  : 	 T%E 
+ : 	 \%E  :  f%  =  t    p  ‘    x  ¦   $ €  Ç   * ˆ ! e  e  e òÐV€úÓV€ ÓV€ÓV€ÓV€Ó •× š× ¦× ,× 5e  >e  CÚV€p× _e  sr €Ð „r v …× ’Ó Ú £× àe  òž €Ð „ž × Ó Ú (× ¢ -e  ûe  × €Ð „× 
+e  Ke  Èr €Ð „r Õe ì     †   ô     – êÕ  !    – ôÛ  <"    – n  Ø#    – n  %    †  4%    † 1  D%    † LA  l%    †W% Œ%    † i1 ´%    † ˆ6 Ü%    † ¥B &    „ Ô J @&    æÔ   P&    †   d&    †  x&    ƒÙW
+ €&    „ Ô J
+ ´&    † ä[ è&    † ùa '    †o ,'    †o L'    †#o l'    † 2s |'    † Oy œ'    † e‚ ¬'    †rJ ¼'    †% Ü'    †– ì'    † ¨‰ (    æÔ    (    ƒ › 0(    †o P(    †!o p(    †1o (    †>o °(    †J À(    † Vo à(    †ao  )    †n )    † {o 0)    †   )    † ©   )    † ¹³ °)    †Â  À)    † з ä)    † y# *    † A $ ,*    †%$ L*    †+o$ l*    † 9 $ |*    † A $ Œ*    † F $ œ*    †Lo$ ¼*    † ]Ç$ Ü*    † l % ì*    † ‚A % ü*    † IA % +    †Po% @+    †Xo%     € – xÝ%     € – ¢á%     € – Èæ&     € – ì(     € – 6œ *     € – ^œ +     € – ‡œ ,     € – ¯ò-     € – Ðœ .     € – ùœ /     € –  	ì0     € – U	ò2     € – ‚	÷3     € – ¨	ü4     € – Ò	5     € – 
+æ:     € – +
+
+<     € – `
+÷B     € – Œ
+œ C     € – ¸
+œ D     € – Ý
+œ E     € – 	œ F     € – 2œ G     € – \òH     € – ‚òI     € – ¤òJ     € – Çœ K     € – ôæL     € –  òN     € – SO     € – ƒœ P     € – ¥œ Q     € – Íœ R     € – õS     € – #
+æV     € – S
+ X     € – z
+([     € – ¬
+œ ]     € – Ú
+ì^     € – .`     € – )òc     € – [5d     € – •òf     € – Ï;g     € – ùœ h     € – )@i     € – sGl     € – ¦Mn     € – ôòr p+    – Us œ+    – 6ct È+    †  u Ð+    á	—zu Ø+    á	Ùu è+    áƒu ð+    á1ˆu $,    æ¿ A u -    æÔ  u -    æu u -    †  u $-    á	1¦u ,-    á	Ùu <-    áƒu D-    áu«u ¨-    æ¿ A u ¨.    æÔ  u ´.    æu u ¼.    †  u Ä.    á	ou Ì.    á	Ùu Ô.    áƒu Ü.    áT¹u /    æ¿ A u ð/    æÔ  u ü/    æu u 0    †  u 0    á	—zu 0    á	Ùu $0    áƒu ,0    á1ˆu `0    æ¿ A u ,1    æÔ  u 81    æu u    ï   û      #   }      }   ¹   }   û   ¼   Ô   ¼   ô   B   I   B   û      I   I   ²   ·      I   I   …   ’      £   â   é   ð   ÷         Ô   ò   ù   ,      ,   ,   ,   ò   ò   ,   ,   I	   ,   ,   ,   ,   â   é   ð   ÷   ,      ,   …   ’      £   O
+   ,   ,   ,   ,   ,   ,   ,   ,   ,   ,   ,      ,   ,   ò   ò   ò   ò   B   
+   ò   B   ò   û      ò   ¢
+   ò   ò   ô   ò   ²   ·   O   ~   †   O   O   O   O   ]   }   O   }   Ù   ê   }   û   O   -   K    
+  
+ 
+ 
+  
+  
+ I          I          I 
+  
+ 
+ 
+  
+  
+ I 	    &   E   &   †   ” .  & : 1 ¿ A 9 Ô  A ã E  †  $ ” . , †  4 ” . I ñ e I ö h Q n Y 6r I Fh a ow i – Y ¨† I · Y ¿‘ I  — y   Y Üœ I ç¡ ™  ¡  ©  ±  ¹  Á  É  Ñ   Ù   á   1 ” ‘ † ƒ$ ” .  †    ¥   ª   ¯    ´  $ ¹  D ¾ . ë Á. ó Ò. û Ò. Ò. Ò. Ø. Ò. #äC3¥ c3¥ ƒ3¥ £3¥ €+¥ @+¥ À
++¥ à
++¥  +¥ @+¥ €+¥ À+¥ à+¥  +¥ @+¥ €+¥ À+¥ à+¥  +¥ @+¥ €+¥ À+¥ à+¥  +¥ @+¥ €+¥ À+¥ à+¥ á ð !-j®Ã^m‘     	   
+      
+    ÆO    É“  Ñ“  Ü“  ç—  òO  “  •“  š“  ¦“  ¯“  ·“  ÀÌ  ÊO  Ö“  à“  d“  h“  {•  ¹š  »´  ¹š  ‘“  ¹š  {•  ¹š 	          	      
+        !   "   #   %   $   (   '   -   1   2 !  6 #  ; %  < '  q )  r +  y -  z /   1  ‚ 3  ‰ 5  Š 7 
+ â 
+ 
+ ä O 
+ æ Q 
+ è   ò   ô O  ö Q  ø   S  O  Q  U 
+ 
+ 
+ O 
+ Q 
+  –' 3 K Q W ^  { x  } ¢   È     ƒ 6  … ^  ‡ ‡  ‰ ¯  ‹ Ð   ù    	  ‘ U	  “ ‚	  • ¨	  — Ò	  ™ 
+  › +
+   `
+  Ÿ Œ
+  ¡ ¸
+  £ Ý
+  ¥ 	  § 2  © \  « ‚  ­ ¤  ¯ Ç  ± ô  ³    µ S  · ƒ  ¹ ¥  » Í  ½ õ  ¿ #
+  Á S
+  Ã z
+  Å ¬
+  Ç Ú
+  É   Ë )  Í [  Ï •  Ñ Ï  Ó ù  Õ )  × s  Ù ¦  Û ô €     nÚ–      ð                   
+     	 
+ 	  mscorlib Object System .ctor Console WriteLine TextWriter System.IO get_Error IEnumerator`1 System.Collections.Generic IEnumerable`1 GetEnumerator get_Current IEnumerator System.Collections MoveNext IDisposable Dispose String Concat IntPtr Zero op_Inequality GC Collect Marshal System.Runtime.InteropServices PtrToStringAnsi op_Equality Interlocked System.Threading CompareExchange Type RuntimeTypeHandle GetTypeFromHandle PtrToStructure ToInt64 SizeOf NotSupportedException ReadIntPtr get_Size LookupExample <Module> LookupExample.exe Sword.Tests Sword InstallManager Manager Module SearchType ModInfo SearchHit NativeMethods <GetModInfoList>c__Iterator0 <Search>c__Iterator1 <MarshalStringArray>c__Iterator2 <MarshallModInfoArray>c__Iterator3 Main args Lookup modName key ParseKeyList Search _handle baseDirectory SetUserDisclaimerConfirmed SyncConfig get_RemoteSources RefreshRemoteSource sourceName GetRemoteModInfoList manager RemoteInstallModule to disposing RemoteSources path get_Handle GetModuleByName name GetModInfoList get_Version get_PrefixPath get_ConfigPath SetGlobalOption option value GetGlobalOptionValues SetCipherKey set_Javascript get_AvailableLocales set_DefaultLocale Translate text localeName Handle Version PrefixPath ConfigPath Javascript AvailableLocales DefaultLocale handle get_Name get_Description get_Category get_KeyText set_KeyText RenderText get_RawEntry set_RawEntry StripText searchString searchType flags scope TerminateSearch PopError get_EntrySize GetEntryAttribute level1 level2 level3 filteredBool keyText HasKeyChildren get_KeyChildren get_KeyParent Prevous Next Begin get_RenderHeader GetConfigEntry DeleteSearchFramework HasSearchFramework Name Description Category KeyText RawEntry EntrySize KeyChildren KeyParent RenderHeader Enum value__ REGEX PHRASE MULTIWORD ENTRYATTR LUCENE ValueType Language _modName _key Score IsNull get_Key get_ModName Key ModName DLLNAME org_crosswire_sword_SWMgr_new libsword.so org_crosswire_sword_SWMgr_newWithPath org_crosswire_sword_SWMgr_getModuleByName hSWMgr moduleName org_crosswire_sword_SWModule_setKeyText hSWModule org_crosswire_sword_SWModule_renderText org_crosswire_sword_SWModule_getRawEntry org_crosswire_sword_SWModule_getKeyText org_crosswire_sword_SWMgr_delete org_crosswire_sword_SWMgr_getModInfoList org_crosswire_sword_SWModule_stripText org_crosswire_sword_SWModule_setRawEntry entryBuffer org_crosswire_sword_SWModule_terminateSearch org_crosswire_sword_SWModule_popError org_crosswire_sword_SWModule_getEntrySize org_crosswire_sword_SWModule_getEntryAttribute org_crosswire_sword_SWModule_parseKeyList org_crosswire_sword_SWModule_search progressReporter org_crosswire_sword_SWModule_hasKeyChildren org_crosswire_sword_SWModule_getKeyChildren org_crosswire_sword_SWModule_getName org_crosswire_sword_SWModule_getDescription org_crosswire_sword_SWModule_getCategory org_crosswire_sword_SWModule_getKeyParent org_crosswire_sword_SWModule_previous org_crosswire_sword_SWModule_next org_crosswire_sword_SWModule_begin org_crosswire_sword_SWModule_getRenderHeader org_crosswire_sword_SWModule_getConfigEntry org_crosswire_sword_SWModule_deleteSearchFramework org_crosswire_sword_SWModule_hasSearchFramework org_crosswire_sword_SWMgr_version org_crosswire_sword_SWMgr_getPrefixPath org_crosswire_sword_SWMgr_getConfigPath org_crosswire_sword_SWMgr_setGlobalOption val org_crosswire_sword_SWMgr_getGlobalOptionValues org_crosswire_sword_SWMgr_setCipherKey org_crosswire_sword_SWMgr_setJavascript valueBool org_crosswire_sword_SWMgr_getAvailableLocales org_crosswire_sword_SWMgr_setDefaultLocale org_crosswire_sword_SWMgr_translate org_crosswire_sword_InstallMgr_reInit hInstallMgr org_crosswire_sword_InstallMgr_new baseDir statusReporter org_crosswire_sword_InstallMgr_setUserDisclaimerConfirmed org_crosswire_sword_InstallMgr_syncConfig org_crosswire_sword_InstallMgr_getRemoteSources org_crosswire_sword_InstallMgr_getRemoteModInfoList hSWMgr_deltaCompareTo org_crosswire_sword_InstallMgr_refreshRemoteSource org_crosswire_sword_InstallMgr_remoteInstallModule hInstallMgr_from hSWMgr_to org_crosswire_sword_InstallMgr_delete MarshalStringArray arrayPtr MarshallModInfoArray pointer IEnumerable <modulesPointer>__0 <modInfo>__1 $PC $current <>f__this System.Collections.Generic.IEnumerator<Sword.ModInfo>.get_Current System.Collections.IEnumerator.get_Current System.Collections.IEnumerable.GetEnumerator System.Collections.Generic.IEnumerable<Sword.ModInfo>.GetEnumerator Reset System.Collections.Generic.IEnumerator<Sword.ModInfo>.Current System.Collections.IEnumerator.Current <searchHitPtr>__0 <searchHit>__1 <$>searchString <$>searchType <$>flags <$>scope System.Collections.Generic.IEnumerator<Sword.SearchHit>.get_Current System.Collections.Generic.IEnumerable<Sword.SearchHit>.GetEnumerator System.Collections.Generic.IEnumerator<Sword.SearchHit>.Current <ptr>__0 <key>__1 <$>arrayPtr System.Collections.Generic.IEnumerator<string>.get_Current System.Collections.Generic.IEnumerable<string>.GetEnumerator System.Collections.Generic.IEnumerator<string>.Current <modInfo>__0 <$>pointer AssemblyTitleAttribute System.Reflection AssemblyDescriptionAttribute AssemblyConfigurationAttribute AssemblyCompanyAttribute AssemblyProductAttribute AssemblyCopyrightAttribute AssemblyTrademarkAttribute RuntimeCompatibilityAttribute System.Runtime.CompilerServices DebuggerHiddenAttribute System.Diagnostics CompilerGeneratedAttribute     9u s a g e :   l o o k u p   < m o d u l e >   < k e y >  ]C o u l d   n o t   f i n d   m o d u l e   { 0 } .     A v a i l a b l e   m o d u l e s :  { 0 } 	   -   { 1 }  /= = R a w = E n t r y = = = = = = = = = = = =  3= = R e n d e r = T e x t = = = = = = = = = = = =  1= = S t r i p = T e x t = = = = = = = = = = = =  5= = = = = = = = = = = = = = = = = = = = = = = = = =  E S V  j n . 3 . 1 6  5= = R e n d e r = E n t r y = = = = = = = = = = = =  R e n d e r T e x t :    S t r i p T e x t :    R a w T e x t :    J a m e s   1 : 1 9 - 3 0  s i n      ·z\V4à‰   
+                   59 5  
+ 5 
+      ÿÿÿÿþÿÿÿýÿÿÿüÿÿÿl i b s w o r d . s o            (      (      ( ( (  
+  
+,    ( 
+
+        
+ 	 
+           0	 4        	( (        (     Sword.Tests       daniel    TWrapNonExceptionThrows ç̲X°OI+àóT”é                                                                                                            €                  0  €                   H   X`  Ð          Ð4   V S _ V E R S I O N _ I N F O     ½ïþ      Ú–n        ?                         D    V a r F i l e I n f o     $    T r a n s l a t i o n      °0   S t r i n g F i l e I n f o      0 0 7 f 0 4 b 0   (   P r o d u c t V e r s i o n       $   C o m p a n y N a m e         $   P r o d u c t N a m e         4   L e g a l C o p y r i g h t   d a n i e l     <   I n t e r n a l N a m e   L o o k u p E x a m p l e   @   F i l e D e s c r i p t i o n     S w o r d . T e s t s      C o m m e n t s       @   F i l e V e r s i o n     1 . 0 . 5 2 3 0 . 3 8 6 1 8     L   O r i g i n a l F i l e n a m e   L o o k u p E x a m p l e . e x e   ,   L e g a l T r a d e m a r k s                                                                                                                                                                                                                                        0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
\ No newline at end of file


Property changes on: trunk/bindings/csharp/examples/LookupExample.exe
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/bindings/csharp/examples/Makefile
===================================================================
--- trunk/bindings/csharp/examples/Makefile	                        (rev 0)
+++ trunk/bindings/csharp/examples/Makefile	2014-04-28 04:40:50 UTC (rev 3199)
@@ -0,0 +1,14 @@
+SWORD_BINDINGS=	\
+	../AssemblyInfo.cs \
+	../InstallManager.cs \
+	../Manager.cs \
+	../Module.cs \
+	../NativeMethods.cs
+
+all: LookupExample.exe
+
+LookupExample.exe: LookupExample.cs
+	gmcs LookupExample.cs ${SWORD_BINDINGS}
+
+clean:
+	rm -f *.exe

Copied: trunk/bindings/csharp/tests/InstallManagerTests.cs (from rev 3198, trunk/bindings/csharp/InstallManagerTests.cs)
===================================================================
--- trunk/bindings/csharp/tests/InstallManagerTests.cs	                        (rev 0)
+++ trunk/bindings/csharp/tests/InstallManagerTests.cs	2014-04-28 04:40:50 UTC (rev 3199)
@@ -0,0 +1,132 @@
+// Copyright 2014  CrossWire Bible Society (http://www.crosswire.org)
+//  	CrossWire Bible Society
+//  	P. O. Box 2528
+//  	Tempe, AZ  85280-2528
+//  
+//  This program is free software; you can redistribute it and/or modify it
+//  under the terms of the GNU General Public License as published by the
+//  Free Software Foundation version 2.
+//  
+//  This program is distributed in the hope that it will be useful, but
+//  WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  General Public License for more details.
+using System;
+using NUnit.Framework;
+using System.Linq;
+
+namespace Sword.Tests
+{
+	[TestFixture]
+	public class InstallManagerTests
+	{
+		InstallManager _installManager;
+		
+		[SetUp]
+		public void Setup()
+		{
+			_installManager = new InstallManager("baseDirectory");
+		}
+		
+		[TearDown]
+		public void TearDown()
+		{
+			_installManager.Dispose();
+		}
+		
+		[Test]
+		public void SetUserDisclaimerConfirmed_Called_DoesntCrash()
+		{
+			_installManager.SetUserDisclaimerConfirmed();
+		}
+		
+		[Test]
+		public void SyncConfig_UserDisclaimerConfirmed_ReturnsTrue()
+		{
+			//arrange
+			_installManager.SetUserDisclaimerConfirmed();
+			
+			//act
+			bool result = _installManager.SyncConfig();
+			
+			//assert
+			Assert.That (result, Is.True);
+		}
+		
+		[Test]
+		public void SyncConfig_UserDisclaimerNotConfirmed_ReturnsFalse()
+		{
+			//act
+			bool result = _installManager.SyncConfig();
+			
+			//assert
+			Assert.That (result, Is.False);
+		}
+		
+		[Test]
+		public void RemoteSources_Called_ReturnsRemoteSources()
+		{
+			//arrange
+			_installManager.SetUserDisclaimerConfirmed();
+			_installManager.SyncConfig();
+			
+			//act
+			var remoteSources = _installManager.RemoteSources.ToArray();
+			
+			//assert
+			Assert.That (remoteSources.Length > 0);
+		}
+		
+		[Test]
+		public void RefreshRemoteSource_Called_ReturnsTrue()
+		{
+			//arrange
+			_installManager.SetUserDisclaimerConfirmed();
+			_installManager.SyncConfig();
+			string firstSource =  _installManager.RemoteSources.First();
+			bool result = _installManager.RefreshRemoteSource(firstSource);
+			
+			//act
+			Assert.That (result, Is.True);
+		}
+		
+		[Test]
+		public void GetRemoteModInfoList_FirstSource_ReturnsModInfoList()
+		{
+			//arrange
+			_installManager.SetUserDisclaimerConfirmed();
+			_installManager.SyncConfig();
+			string firstSource =  _installManager.RemoteSources.First();
+			_installManager.RefreshRemoteSource(firstSource);
+			
+			ModInfo[] remoteModInfos;
+			using(Manager manager = new Manager())
+			{
+				//act
+				remoteModInfos = _installManager.GetRemoteModInfoList(manager, firstSource).ToArray();
+			}
+			
+			//assert
+			Assert.That (remoteModInfos.Length, Is.GreaterThan(0));
+		}
+		
+		[Test]
+		public void RemoteInstallModule_KJV_ReturnsTrue()
+		{
+			//arrange
+			_installManager.SetUserDisclaimerConfirmed();
+			Assert.That (_installManager.SyncConfig(), Is.True);
+			Assert.That (_installManager.RefreshRemoteSource("CrossWire"), Is.True);
+			
+			using(Manager manager = new Manager("LocalManager"))
+			{
+				//act
+				bool result = _installManager.RemoteInstallModule(manager, "CrossWire", "KJV");
+				
+				//assert
+				Assert.That (result, Is.True);
+			}
+		}
+	}
+}
+

Copied: trunk/bindings/csharp/tests/ManagerTests.cs (from rev 3198, trunk/bindings/csharp/ManagerTests.cs)
===================================================================
--- trunk/bindings/csharp/tests/ManagerTests.cs	                        (rev 0)
+++ trunk/bindings/csharp/tests/ManagerTests.cs	2014-04-28 04:40:50 UTC (rev 3199)
@@ -0,0 +1,111 @@
+// Copyright 2014  CrossWire Bible Society (http://www.crosswire.org)
+//  	CrossWire Bible Society
+//  	P. O. Box 2528
+//  	Tempe, AZ  85280-2528
+//  
+//  This program is free software; you can redistribute it and/or modify it
+//  under the terms of the GNU General Public License as published by the
+//  Free Software Foundation version 2.
+//  
+//  This program is distributed in the hope that it will be useful, but
+//  WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  General Public License for more details.
+using System;
+using NUnit.Framework;
+using System.IO;
+using System.Linq;
+
+namespace Sword.Tests
+{
+	[TestFixture]
+	public class ManagerTests
+	{
+		Manager _manager;
+		
+		[TestFixtureSetUp]
+		public void Setup()
+		{
+			_manager = new Manager();
+		}
+		
+		[TestFixtureTearDown]
+		public void TearDown()
+		{
+			_manager.Dispose();	
+		}
+		
+		[Test]
+		public void Version_Get_ReturnsAVersion()
+		{
+			//act
+			string swordVersion = _manager.Version;
+			
+			//assert
+			Version version;
+			Assert.That (Version.TryParse(swordVersion, out version));
+		}
+		
+		[Test]
+		public void PrefixPath_Get_ReturnsValidPath()
+		{
+			//act
+			string prefixPath = _manager.PrefixPath;
+			
+			//assert
+			Assert.That (Directory.Exists(prefixPath), Is.True);
+		}
+		
+		[Test]
+		public void ConfigPath_Get_ReturnsValidPath()
+		{
+			//act
+			string configPath = _manager.ConfigPath;
+			
+			//assert
+			Assert.That (Directory.Exists(configPath), Is.True);
+		}
+		
+		[Test]
+		public void SetCipherKey_Called_DoesntCrash()
+		{
+			//act
+			_manager.SetCipherKey("ESV", new byte[32]);
+		}
+		
+		[Test]
+		public void Javascript_Set_DoesntCrash()
+		{
+			//act
+			_manager.Javascript = true;
+		}
+		
+		[Test]
+		public void AvailableLocales_Get_DoesntCrash()
+		{
+			//act
+			var availableLocales = _manager.AvailableLocales.ToArray();
+			
+			//Assert
+			Assert.That (availableLocales[0].Contains("en"));
+		}
+		
+		[Test]
+		public void DefaultLocale_SetToEn_DoesntCrash()
+		{
+			//act
+			_manager.DefaultLocale = "en";
+		}
+		
+		[Test]
+		public void Translate_EnglishToEnglish_ReturnsOrginal()
+		{
+			//act
+			var result = _manager.Translate("love", "en");
+				
+			//assert
+			Assert.That (result, Is.EqualTo("love"));
+		}
+	}
+}
+

Copied: trunk/bindings/csharp/tests/ModuleTests.cs (from rev 3198, trunk/bindings/csharp/ModuleTests.cs)
===================================================================
--- trunk/bindings/csharp/tests/ModuleTests.cs	                        (rev 0)
+++ trunk/bindings/csharp/tests/ModuleTests.cs	2014-04-28 04:40:50 UTC (rev 3199)
@@ -0,0 +1,162 @@
+// Copyright 2014  CrossWire Bible Society (http://www.crosswire.org)
+//  	CrossWire Bible Society
+//  	P. O. Box 2528
+//  	Tempe, AZ  85280-2528
+//  
+//  This program is free software; you can redistribute it and/or modify it
+//  under the terms of the GNU General Public License as published by the
+//  Free Software Foundation version 2.
+//  
+//  This program is distributed in the hope that it will be useful, but
+//  WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  General Public License for more details.
+using System;
+using NUnit.Framework;
+using System.IO;
+
+namespace Sword.Tests
+{
+	[TestFixture]
+	public class ModuleTests
+	{
+		Module _swordModule;
+		Manager _swordManager;
+		
+		[TestFixtureSetUp]
+		public void Setup()
+		{
+			_swordManager = new Manager("LocalManager");
+			_swordModule = _swordManager.GetModuleByName("ESV");
+			
+			if(_swordModule != null)
+			{
+				return;	
+			}
+			using(var installManager = new InstallManager("baseDirectory"))
+			{
+				installManager.SetUserDisclaimerConfirmed();
+				installManager.SyncConfig();
+				installManager.RefreshRemoteSource("CrossWire");
+			
+				installManager.RemoteInstallModule(_swordManager, "CrossWire", "ESV");
+				_swordModule = _swordManager.GetModuleByName("ESV");
+			}
+		}
+		
+		[TestFixtureTearDown]
+		public void TearDown()
+		{
+			_swordManager.Dispose();
+		}
+		
+		[Test]
+		public void Name_Get_Esv()
+		{
+			//arrange
+			//act
+			string name =_swordModule.Name;
+			
+			//assert
+			Assert.That (name, Is.EqualTo ("ESV"));
+		}
+		
+		[Test]
+		public void Description_Get_DescriptionCorrect()
+		{
+			//arrange
+			//act
+			string description =_swordModule.Description;
+			
+			//assert
+			Assert.That (description, Is.EqualTo ("English Standard Version"));
+		}
+		
+		[Test]
+		public void Catagory_Get_CatagoryCorrect()
+		{
+			//arrange
+			//act
+			string catagory =_swordModule.Category;
+			
+			//assert
+			Assert.That (catagory, Is.EqualTo ("Biblical Texts"));
+		}
+		
+		[Test]
+		public void Previous_John3v16_John3v15()
+		{
+			//arrange
+			_swordModule.KeyText = "jn.3.16";
+			
+			//act
+			_swordModule.Prevous();
+			
+			//assert
+			Assert.That (_swordModule.KeyText, Is.EqualTo( "John 3:15"));
+		}
+		
+		[Test]
+		public void Next_John3v15_John3v16()
+		{
+			//arrange
+			_swordModule.KeyText = "jn.3.15";
+			
+			//act
+			_swordModule.Next();
+			
+			//assert
+			Assert.That (_swordModule.KeyText, Is.EqualTo( "John 3:16"));
+		}
+		
+		[Test]
+		public void Begin_John3v15_Genesis1v1()
+		{
+			//arrange
+			_swordModule.KeyText = "jn.3.15";
+			
+			//act
+			_swordModule.Begin();
+			
+			//assert
+			Assert.That (_swordModule.KeyText, Is.EqualTo( "Genesis 1:1"));
+		}
+		
+		[Test]
+		public void RenderHeader_John3v16_ReturnsNonNullOrEmpty()
+		{
+			//arrange
+			_swordModule.KeyText = "jn.3.16";
+			
+			//act
+			string header = _swordModule.RenderHeader;
+			
+			//assert
+			Assert.That (!string.IsNullOrEmpty(header));
+		}
+		
+		[Test]
+		public void RawEntry_Get_ContainsVerse()
+		{
+			//arrange
+			_swordModule.KeyText = "jn.3.16";
+
+			//act
+			string rawEntry = _swordModule.RawEntry;
+			
+			//assert
+			Assert.That (rawEntry.Contains ("God so loved"));
+		}
+		
+		public void HasSearchFramework_Doesnt_ReturnsFalse()
+		{
+			//arrange
+			//act
+			bool hasSearchFramework = _swordModule.HasSearchFramework();
+			
+			//assert
+			Assert.That (hasSearchFramework, Is.False);
+		}
+	}
+}
+

Copied: trunk/bindings/csharp/tests/Sword.Tests.csproj (from rev 3198, trunk/bindings/csharp/Sword.Tests.csproj)
===================================================================
--- trunk/bindings/csharp/tests/Sword.Tests.csproj	                        (rev 0)
+++ trunk/bindings/csharp/tests/Sword.Tests.csproj	2014-04-28 04:40:50 UTC (rev 3199)
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>10.0.0</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{72212684-1186-4F68-8FBD-BDBFDB8CC9BC}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>Sword.Tests</RootNamespace>
+    <AssemblyName>CSSword.Tests</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug</OutputPath>
+    <DefineConstants>DEBUG;</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Externalconsole>true</Externalconsole>
+    <Commandlineparameters>ESV jn.3.16</Commandlineparameters>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>none</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Release</OutputPath>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Externalconsole>true</Externalconsole>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="nunit.core, Version=2.5.10.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
+      <Private>False</Private>
+      <Package>mono-nunit</Package>
+    </Reference>
+    <Reference Include="nunit.framework, Version=2.5.10.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
+      <Private>False</Private>
+      <Package>mono-nunit</Package>
+    </Reference>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="AssemblyInfo.cs" />
+    <Compile Include="FlatApiLookup.cs" />
+    <Compile Include="ModuleTests.cs" />
+    <Compile Include="ManagerTests.cs" />
+    <Compile Include="InstallManagerTests.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <ItemGroup>
+    <ProjectReference Include="..\Sword\Sword.csproj">
+      <Project>{EFEE3557-86F2-4E46-AF7E-8BADEE240764}</Project>
+      <Name>Sword</Name>
+    </ProjectReference>
+  </ItemGroup>
+</Project>
\ No newline at end of file




More information about the sword-cvs mailing list