diff options
author | Teus Benschop <teusjannette@gmail.com> | 2018-10-28 11:51:26 +0100 |
---|---|---|
committer | Teus Benschop <teusjannette@gmail.com> | 2018-10-28 11:51:26 +0100 |
commit | 1d0ff54794b5edea7cdf1d2d66710a0fa885bcc5 (patch) | |
tree | 8ece5f9ef437fbb151f2b22ed0c6e1a714879c7c /bindings/csharp | |
parent | c7dbdc9161a7c460526b80fe01af49d714856126 (diff) |
New upstream version 1.8.1
Diffstat (limited to 'bindings/csharp')
-rw-r--r-- | bindings/csharp/NativeMethods.cs | 36 | ||||
-rw-r--r-- | bindings/csharp/tests/ManagerTests.cs | 15 |
2 files changed, 31 insertions, 20 deletions
diff --git a/bindings/csharp/NativeMethods.cs b/bindings/csharp/NativeMethods.cs index 6a3c911..6ea973b 100644 --- a/bindings/csharp/NativeMethods.cs +++ b/bindings/csharp/NativeMethods.cs @@ -33,6 +33,8 @@ namespace Sword public string Description; public string Category; public string Language; + public string Version; + public string Delta; }; [StructLayout(LayoutKind.Sequential)] @@ -73,53 +75,51 @@ namespace Sword public static class NativeMethods { + public const string DLLNAME = "libsword"; - - public const string DLLNAME = "libsword.so"; - - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr org_crosswire_sword_SWMgr_new(); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr org_crosswire_sword_SWMgr_newWithPath(string path); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr org_crosswire_sword_SWMgr_getModuleByName(IntPtr hSWMgr, string moduleName); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern void org_crosswire_sword_SWModule_setKeyText(IntPtr hSWModule, string key); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr org_crosswire_sword_SWModule_renderText(IntPtr hSWModule); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr org_crosswire_sword_SWModule_getRawEntry(IntPtr hSWModule); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr org_crosswire_sword_SWModule_getKeyText(IntPtr hSWModule); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern void org_crosswire_sword_SWMgr_delete(IntPtr hSWMgr); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr org_crosswire_sword_SWMgr_getModInfoList(IntPtr hSWMgr); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr org_crosswire_sword_SWModule_stripText(IntPtr hSWModule); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern void org_crosswire_sword_SWModule_setRawEntry(IntPtr hSWModule, string entryBuffer); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern void org_crosswire_sword_SWModule_terminateSearch(IntPtr hSWModule); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern char org_crosswire_sword_SWModule_popError(IntPtr hSWModule); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern long org_crosswire_sword_SWModule_getEntrySize(IntPtr hSWModule); - [DllImport(DLLNAME)] + [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr org_crosswire_sword_SWModule_getEntryAttribute(IntPtr hSWModule, string level1, string level2, string level3, char filteredBool); [DllImport(DLLNAME, CallingConvention = CallingConvention.Cdecl)] diff --git a/bindings/csharp/tests/ManagerTests.cs b/bindings/csharp/tests/ManagerTests.cs index 6f71b33..ec7d6cd 100644 --- a/bindings/csharp/tests/ManagerTests.cs +++ b/bindings/csharp/tests/ManagerTests.cs @@ -14,6 +14,7 @@ using System; using NUnit.Framework; using System.IO; +using System.Collections.Generic; using System.Linq; namespace Sword.Tests @@ -84,10 +85,20 @@ namespace Sword.Tests public void AvailableLocales_Get_DoesntCrash() { //act - var availableLocales = _manager.AvailableLocales.ToArray(); + string[] availableLocales = _manager.AvailableLocales.ToArray(); //Assert - Assert.That (availableLocales[0].Contains("en")); + Assert.That (availableLocales.Length > 0); + } + + [Test] + public void AvailableLocales_Get_ContainsEnglish() + { + //act + string[] availableLocales = _manager.AvailableLocales.ToArray(); + + //Assert + Assert.That (availableLocales.Any(locale => locale == "en")); } [Test] |