--- /dev/null
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+using System;
+using NUnitLite.TUnit;
+using AutoTemplate;
+
+namespace XamarinForTizen.Tizen
+{
+
+ class Program : global::Xamarin.Forms.Platform.Tizen.FormsApplication
+ {
+ private static App _app;
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+
+ Console.WriteLine("TCT : OnCreate()");
+ _app = new App();
+ LoadApplication(_app);
+
+ TRunner t = new TRunner();
+ t.LoadTestsuite();
+ t.Execute();
+ }
+
+ public static App getApp()
+ {
+ return _app;
+ }
+ static void Main(string[] args)
+ {
+ Console.WriteLine("TCT : Main()");
+ var app = new Program();
+ global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);
+ app.Run(args);
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <!-- Property Group for .NET Core Project -->
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>tizen50</TargetFramework>
+ </PropertyGroup>
+
+ <!-- Property Group for Tizen Project -->
+ <PropertyGroup>
+ <TizenCreateTpkOnBuild>true</TizenCreateTpkOnBuild>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Folder Include="lib\" />
+ </ItemGroup>
+
+ <Import Project="..\Common\dependencies.props" />
+
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="$(TizenNETVersion)">
+ <ExcludeAssets>Runtime</ExcludeAssets>
+ </PackageReference>
+ <PackageReference Include="Tizen.NET.Sdk" Version="$(TizenNETSdkVersion)" />
+ </ItemGroup>
+
+ <!-- Include Nuget Package for Tizen Project building -->
+ <ItemGroup>
+ <ProjectReference Include="..\Template\AutoTemplate\AutoTemplate.csproj" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.26730.15
+MinimumVisualStudioVersion = 15.0.26124.0
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tizen.Nlp.Tests", "Tizen.Nlp.Tests.csproj", "{D92BEEAC-3B2A-45F8-8C53-53B92550404A}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunit.framework", "..\nunit.framework\nunit.framework.csproj", "{B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "nunitlite", "..\nunitlite\nunitlite.csproj", "{FDB8025A-C029-461F-895E-287B4C65939B}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoTemplate", "..\Template\AutoTemplate\AutoTemplate.csproj", "{B11ABB0C-C3C1-4B5C-8251-A15628A775F3}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x64.Build.0 = Debug|Any CPU
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Debug|x86.Build.0 = Debug|Any CPU
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.ActiveCfg = Release|Any CPU
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x64.Build.0 = Release|Any CPU
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.ActiveCfg = Release|Any CPU
+ {D92BEEAC-3B2A-45F8-8C53-53B92550404A}.Release|x86.Build.0 = Release|Any CPU
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x64.Build.0 = Debug|Any CPU
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Debug|x86.Build.0 = Debug|Any CPU
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|Any CPU.Build.0 = Release|Any CPU
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.ActiveCfg = Release|Any CPU
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x64.Build.0 = Release|Any CPU
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.ActiveCfg = Release|Any CPU
+ {B9E7C1FD-CB38-42F7-AC43-7BD2E5B4D216}.Release|x86.Build.0 = Release|Any CPU
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x64.Build.0 = Debug|Any CPU
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Debug|x86.Build.0 = Debug|Any CPU
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.ActiveCfg = Release|Any CPU
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x64.Build.0 = Release|Any CPU
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.ActiveCfg = Release|Any CPU
+ {FDB8025A-C029-461F-895E-287B4C65939B}.Release|x86.Build.0 = Release|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.NUI|Any CPU.ActiveCfg = Debug|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.NUI|Any CPU.Build.0 = Debug|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {B11ABB0C-C3C1-4B5C-8251-A15628A775F3}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {ED382B91-9930-40B6-B3D7-362304C78680}
+ EndGlobalSection
+EndGlobal
--- /dev/null
+/*\r
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License\r
+ */\r
+\r
+using NUnit.Framework;\r
+using NUnit.Framework.TUnit;\r
+using System;\r
+using System.Threading;\r
+using System.Threading.Tasks;\r
+using System.Collections.Generic;\r
+using Tizen;\r
+using Tizen.Nlp;\r
+using Tizen.Applications;\r
+using Tizen.Applications.Messages;\r
+\r
+namespace Tizen.Nlp.Tests {\r
+\r
+ [TestFixture]\r
+ [Description("Tizen.Nlp.LanguageDetectedResult test")]\r
+ public class LanguageDetectedResultTests\r
+ {\r
+\r
+ [SetUp]\r
+ public static void Init()\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Preconditions for each TEST");\r
+ }\r
+\r
+ [TearDown]\r
+ public static void Destroy()\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Postconditions for each TEST");\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Test: Check if constructor for the class returns correct object instance")]\r
+ [Property("SPEC", "Tizen.Nlp.LanguageDetectedResult.LanguageDetectedResult C")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "CONSTR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static void LanguageDetectedResult_INIT()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+ LanguageDetectedResult res = new LanguageDetectedResult();\r
+ Assert.IsInstanceOf<LanguageDetectedResult>(res, "Expecting LanguageDetectedResult object");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the return value of LanguageDetectedResult Language is correct or not")]\r
+ [Property("SPEC", "Tizen.Nlp.LanguageDetectedResult.Language A")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "PRO")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task Language_RETURN_VALUE()\r
+ {\r
+ try\r
+ {\r
+ /* TEST CODE */\r
+ NaturalLanguageProcess nlp = new NaturalLanguageProcess();\r
+ await nlp.Connect();\r
+ await Task.Delay(30);\r
+ LanguageDetectedResult res;\r
+ string msg = "This is a test case of the NLP project.";\r
+ res = await nlp.LanguageDetectAsync(msg);\r
+ Assert.IsTrue(res.Language.Equals("en"), "The return value of Language is correct");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License\r
+ */\r
+\r
+using NUnit.Framework;\r
+using NUnit.Framework.TUnit;\r
+using System;\r
+using System.Threading;\r
+using System.Threading.Tasks;\r
+using System.Collections.Generic;\r
+using Tizen;\r
+using Tizen.Nlp;\r
+using Tizen.Applications;\r
+using Tizen.Applications.Messages;\r
+\r
+namespace Tizen.Nlp.Tests {\r
+\r
+ [TestFixture]\r
+ [Description("Tizen.Nlp.LemmatizeResult test")]\r
+ public class LemmatizeResultTests\r
+ {\r
+ static NaturalLanguageProcess nlp = null;\r
+\r
+ [SetUp]\r
+ public static void Init()\r
+ {\r
+ nlp = new NaturalLanguageProcess();\r
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Preconditions for each TEST");\r
+ }\r
+\r
+ [TearDown]\r
+ public static void Destroy()\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Postconditions for each TEST");\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Test: Check if constructor for the class returns correct object instance")]\r
+ [Property("SPEC", "Tizen.Nlp.LemmatizeResult.LemmatizeResult C")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "CONSTR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static void LemmatizeResult_INIT()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+ LemmatizeResult res = new LemmatizeResult();\r
+ Assert.IsInstanceOf<LemmatizeResult>(res, "Expecting LemmatizeResult object");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the return value of LemmatizeResult Tags is correct or not")]\r
+ [Property("SPEC", "Tizen.Nlp.LemmatizeResult.Tags A")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "PRO")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task Tags_RETURN_VALUE()\r
+ {\r
+ try\r
+ {\r
+ /* TEST CODE */\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ try\r
+ {\r
+ Task task = nlp.Connect();\r
+ await task;\r
+ await Task.Delay(100);\r
+ }\r
+ catch\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "nlp has connected");\r
+ }\r
+ LemmatizeResult res;\r
+ string msg = "raining";\r
+ res = await nlp.LemmatizeaAsync(msg);\r
+ Assert.IsTrue(res.ActualWord.Equals("rain"), "The return value of tag is correct");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License\r
+ */\r
+\r
+using NUnit.Framework;\r
+using NUnit.Framework.TUnit;\r
+using System;\r
+using System.Threading;\r
+using System.Threading.Tasks;\r
+using System.Collections.Generic;\r
+using Tizen;\r
+using Tizen.Nlp;\r
+using Tizen.Applications;\r
+using Tizen.Applications.Messages;\r
+\r
+namespace Tizen.Nlp.Tests {\r
+\r
+ [TestFixture]\r
+ [Description("Tizen.Nlp.NamedEntityRecognitionResult test")]\r
+ public class NamedEntityRecognitionResultTests\r
+ {\r
+ static NaturalLanguageProcess nlp = null;\r
+ [SetUp]\r
+ public static void Init()\r
+ {\r
+ nlp = new NaturalLanguageProcess();\r
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Preconditions for each TEST");\r
+ }\r
+\r
+ [TearDown]\r
+ public static void Destroy()\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Postconditions for each TEST");\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Test: Check if constructor for the class returns correct object instance")]\r
+ [Property("SPEC", "Tizen.Nlp.NamedEntityRecognitionResult.NamedEntityRecognitionResult C")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "CONSTR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static void NamedEntityRecognitionResult_INIT()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+ NamedEntityRecognitionResult res = new NamedEntityRecognitionResult();\r
+ Assert.IsInstanceOf<NamedEntityRecognitionResult>(res, "Expecting NamedEntityRecognitionResult object");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the return value of NamedEntityRecognitionResult Tags is correct or not")]\r
+ [Property("SPEC", "Tizen.Nlp.NamedEntityRecognitionResult.Tags A")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "PRO")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task Tags_RETURN_VALUE()\r
+ {\r
+ try\r
+ {\r
+ /* TEST CODE */\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ try\r
+ {\r
+ var task = nlp.Connect();\r
+ await task;\r
+ await Task.Delay(30);\r
+ }\r
+ catch\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "nlp has connected");\r
+ }\r
+ NamedEntityRecognitionResult res;\r
+ string msg = "This is a test case of the NLP project.";\r
+ res =await nlp.NamedEntityRecognitionAsync(msg);\r
+ IList<string> rs_tag = new List<string>();\r
+ rs_tag.Add("DT");\r
+ rs_tag.Add("VBZ");\r
+ rs_tag.Add("DT");\r
+ rs_tag.Add("NN");\r
+ rs_tag.Add("NN");\r
+ rs_tag.Add("IN");\r
+ rs_tag.Add("DT");\r
+ rs_tag.Add("NNP");\r
+ rs_tag.Add("NN");\r
+ rs_tag.Add(".");\r
+ for (int i = 0; i < res.Tags.Count; i++)\r
+ Assert.IsTrue(res.Tags[i].Equals(rs_tag[i]), "The return value of tag is correct");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the return value of NamedEntityRecognitionResult Tokens is correct or not")]\r
+ [Property("SPEC", "Tizen.Nlp.NamedEntityRecognitionResult.Tokens A")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "PRO")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task Tokens_RETURN_VALUE()\r
+ {\r
+ try\r
+ {\r
+ /* TEST CODE */\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ try\r
+ {\r
+ var task = nlp.Connect();\r
+ await task;\r
+ await Task.Delay(30);\r
+ }\r
+ catch\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "nlp has connected");\r
+ }\r
+ NamedEntityRecognitionResult res;\r
+ string msg = "This is a test case of the NLP project.";\r
+ res =await nlp.NamedEntityRecognitionAsync(msg);\r
+ IList<string> rs_token = new List<string>();\r
+ rs_token.Add("This");\r
+ rs_token.Add("is");\r
+ rs_token.Add("a");\r
+ rs_token.Add("test");\r
+ rs_token.Add("case");\r
+ rs_token.Add("of");\r
+ rs_token.Add("the");\r
+ rs_token.Add("NLP");\r
+ rs_token.Add("project");\r
+ rs_token.Add(".");\r
+ for (int i = 0; i < res.Tokens.Count; i++)\r
+ Assert.IsTrue(res.Tokens[1].Equals(rs_token[1]), "The return token value of token is correct");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License\r
+ */\r
+\r
+using NUnit.Framework;\r
+using NUnit.Framework.TUnit;\r
+using System;\r
+using System.Threading;\r
+using System.Threading.Tasks;\r
+using System.Collections.Generic;\r
+using Tizen;\r
+using Tizen.Nlp;\r
+using Tizen.Applications;\r
+using Tizen.Applications.Messages;\r
+\r
+namespace Tizen.Nlp.Tests {\r
+\r
+ [TestFixture]\r
+ [Description("Tizen.Nlp.NaturalLanguageProcess test")]\r
+ public class NaturalLanguageProcessTests\r
+ {\r
+ static NaturalLanguageProcess nlp = null;\r
+ [SetUp]\r
+ public static void Init()\r
+ {\r
+ nlp = new NaturalLanguageProcess();\r
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Preconditions for each TEST");\r
+ }\r
+\r
+ [TearDown]\r
+ public static void Destroy()\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Postconditions for each TEST");\r
+ }\r
+\r
+ public static void Disconnected(object s,EventArgs e) {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "disconnected");\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Test: Check if constructor for the class returns correct object instance")]\r
+ [Property("SPEC", "Tizen.Nlp.NaturalLanguageProcess.NaturalLanguageProcess C")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "CONSTR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static void NaturalLanguageProcess_INIT()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+ Assert.IsInstanceOf<NaturalLanguageProcess>(nlp, "Expecting NaturalLanguageProcess object");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the working of NLP Disconnected for No Exception")]\r
+ [Property("SPEC", "Tizen.Nlp.NaturalLanguageProcess.Disconnected E")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "EEX")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task Disconnected_CHECK_EVENT_USING_PASSIVE_WITH_EXCEPTION()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ try\r
+ {\r
+ var task = nlp.Connect();\r
+ await task;\r
+ await Task.Delay(30);\r
+ }\r
+ catch\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "nlp has connected");\r
+ }\r
+ nlp.Disconnected += Disconnected;\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the working of NLP Connect method for No Exception")]\r
+ [Property("SPEC", "Tizen.Nlp.NaturalLanguageProcess.Connect M")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "MR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task Connect_NO_EXCEPTION()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ try\r
+ {\r
+ var task = nlp.Connect();\r
+ await task;\r
+ await Task.Delay(30);\r
+ }\r
+ catch\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "nlp has connected");\r
+ }\r
+ ;\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the working of NLP WordTokenizeAsync method for No Exception")]\r
+ [Property("SPEC", "Tizen.Nlp.NaturalLanguageProcess.WordTokenizeAsync M")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "MR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task WordTokenizeAsync_RETURN_VALUE()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ try\r
+ {\r
+ var task = nlp.Connect();\r
+ await task;\r
+ await Task.Delay(30);\r
+ }\r
+ catch\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "nlp has connected");\r
+ }\r
+ WordTokenizeResult res;\r
+ string msg = "This is a test case of the NLP project.";\r
+ res = await nlp.WordTokenizeAsync(msg);\r
+ IList<string> rs_token = new List<string>();\r
+ rs_token.Add("This");\r
+ rs_token.Add("is");\r
+ rs_token.Add("a");\r
+ rs_token.Add("test");\r
+ rs_token.Add("case");\r
+ rs_token.Add("of");\r
+ rs_token.Add("the");\r
+ rs_token.Add("NLP");\r
+ rs_token.Add("project");\r
+ rs_token.Add(".");\r
+ for (int i = 0; i < res.Tokens.Count; i++)\r
+ Assert.IsTrue(rs_token[i].Equals(res.Tokens[i]), "The return value of WordTokenizeAsyncTask is correct");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the working of NLP PosTagAsync method for No Exception")]\r
+ [Property("SPEC", "Tizen.Nlp.NaturalLanguageProcess.PosTagAsync M")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "MR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task PosTagAsync_RETURN_VALUE()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ try\r
+ {\r
+ var task = nlp.Connect();\r
+ await task;\r
+ await Task.Delay(30);\r
+ }\r
+ catch\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "nlp has connected");\r
+ }\r
+ PosTagResult res;\r
+ string msg = "This is a test case of the NLP project.";\r
+ res = await nlp.PosTagAsync(msg);\r
+ IList<string> rs_token = new List<string>();\r
+ IList<string> rs_tag = new List<string>();\r
+ rs_token.Add("This");\r
+ rs_tag.Add("DT");\r
+ rs_token.Add("is");\r
+ rs_tag.Add("VBZ");\r
+ rs_token.Add("a");\r
+ rs_tag.Add("DT");\r
+ rs_token.Add("test");\r
+ rs_tag.Add("NN");\r
+ rs_token.Add("case");\r
+ rs_tag.Add("NN");\r
+ rs_token.Add("of");\r
+ rs_tag.Add("IN");\r
+ rs_token.Add("the");\r
+ rs_tag.Add("DT");\r
+ rs_token.Add("NLP");\r
+ rs_tag.Add("NNP");\r
+ rs_token.Add("project");\r
+ rs_tag.Add("NN");\r
+ rs_token.Add(".");\r
+ rs_tag.Add(".");\r
+ for (int i = 0; i < res.Tokens.Count; i++)\r
+ {\r
+ Assert.IsTrue(rs_token[i].Equals(res.Tokens[i]), "The return token value of WordTokenizeAsyncTask is correct");\r
+ Assert.IsTrue(rs_tag[i].Equals(res.Tags[i]), "The return tag value of PosTagAsyncTask is correct");\r
+ }\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the working of NLP NamedEntityRecognitionAsync method for No Exception")]\r
+ [Property("SPEC", "Tizen.Nlp.NaturalLanguageProcess.NamedEntityRecognitionAsync M")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "MR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task NamedEntityRecognitionAsync_RETURN_VALUE()\r
+ {\r
+ /* TEST CODE */\r
+ try {\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ try\r
+ {\r
+ var task = nlp.Connect();\r
+ await task;\r
+ await Task.Delay(30);\r
+ }\r
+ catch\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "nlp has connected");\r
+ }\r
+ NamedEntityRecognitionResult res;\r
+ string msg = "This is a test case of the NLP project.";\r
+ res = await nlp.NamedEntityRecognitionAsync(msg);\r
+ IList<string> rs_token = new List<string>();\r
+ IList<string> rs_tag = new List<string>();\r
+ rs_token.Add("This");\r
+ rs_tag.Add("DT");\r
+ rs_token.Add("is");\r
+ rs_tag.Add("VBZ");\r
+ rs_token.Add("a");\r
+ rs_tag.Add("DT");\r
+ rs_token.Add("test");\r
+ rs_tag.Add("NN");\r
+ rs_token.Add("case");\r
+ rs_tag.Add("NN");\r
+ rs_token.Add("of");\r
+ rs_tag.Add("IN");\r
+ rs_token.Add("the");\r
+ rs_tag.Add("DT");\r
+ rs_token.Add("NLP");\r
+ rs_tag.Add("NNP");\r
+ rs_token.Add("project");\r
+ rs_tag.Add("NN");\r
+ rs_token.Add(".");\r
+ rs_tag.Add(".");\r
+ for (int i = 0; i < res.Tokens.Count; i++)\r
+ {\r
+ Assert.IsTrue(rs_token[i].Equals(res.Tokens[i]), "The return token value of NamedEntityRecognitionAsyncTask is correct");\r
+ Assert.IsTrue(rs_tag[i].Equals(res.Tags[i]), "The return tag value of NamedEntityRecognitionAsyncTask is correct");\r
+ }\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the working of NLP LanguageDetectAsync method for No Exception")]\r
+ [Property("SPEC", "Tizen.Nlp.NaturalLanguageProcess.LanguageDetectAsync M")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "MR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task LanguageDetectAsync_RETURN_VALUE()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ try\r
+ {\r
+ var task = nlp.Connect();\r
+ await task;\r
+ await Task.Delay(30);\r
+ }\r
+ catch\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "nlp has connected");\r
+ }\r
+ LanguageDetectedResult res;\r
+ string msg = "This is a test case of the NLP project.";\r
+ res = await nlp.LanguageDetectAsync(msg);\r
+ Assert.IsTrue(res.Language.Equals("en"), "The return tag value of LanguageDetectAsyncTask is correct");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the working of NLP LemmatizeaAsync method for No Exception")]\r
+ [Property("SPEC", "Tizen.Nlp.NaturalLanguageProcess.LemmatizeaAsync M")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "MR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task LemmatizeaAsync_RETURN_VALUE()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ try\r
+ {\r
+ var task = nlp.Connect();\r
+ await task;\r
+ await Task.Delay(100);\r
+ }\r
+ catch\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "nlp has connected");\r
+ }\r
+ LemmatizeResult res;\r
+ string msg = "raining";\r
+ res = await nlp.LemmatizeaAsync(msg);\r
+ IList<string> rs_token = new List<string>();\r
+ Assert.IsTrue(res.ActualWord.Equals("rain"), "The return value of tag is correct");\r
+ nlp.Close();\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the working of NLP Close method for No Exception")]\r
+ [Property("SPEC", "Tizen.Nlp.NaturalLanguageProcess.Close M")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "MR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static void Close_NO_EXCEPTION()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ nlp.Close();\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the working of NLP Dispose method for No Exception")]\r
+ [Property("SPEC", "Tizen.Nlp.NaturalLanguageProcess.Dispose M")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "MR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static void Dispose_NO_EXCEPTION()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ nlp.Dispose();\r
+ nlp = null;\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License\r
+ */\r
+\r
+using NUnit.Framework;\r
+using NUnit.Framework.TUnit;\r
+using System;\r
+using System.Threading;\r
+using System.Threading.Tasks;\r
+using System.Collections.Generic;\r
+using Tizen;\r
+using Tizen.Nlp;\r
+using Tizen.Applications;\r
+using Tizen.Applications.Messages;\r
+\r
+namespace Tizen.Nlp.Tests {\r
+\r
+ [TestFixture]\r
+ [Description("Tizen.Nlp.PosTagResult test")]\r
+ public class PosTagResultTests\r
+ {\r
+ static NaturalLanguageProcess nlp = null;\r
+\r
+ [SetUp]\r
+ public static void Init()\r
+ {\r
+ nlp = new NaturalLanguageProcess();\r
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Preconditions for each TEST");\r
+ }\r
+\r
+ [TearDown]\r
+ public static void Destroy()\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Postconditions for each TEST");\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Test: Check if constructor for the class returns correct object instance")]\r
+ [Property("SPEC", "Tizen.Nlp.PosTagResult.PosTagResult C")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "CONSTR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static void PosTagResult_INIT()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+ PosTagResult res = new PosTagResult();\r
+ Assert.IsInstanceOf<PosTagResult>(res, "Expecting PosTagResult object");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the return value of PosTagResult Tags is correct or not")]\r
+ [Property("SPEC", "Tizen.Nlp.PosTagResult.Tags A")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "PRO")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task Tags_RETURN_VALUE()\r
+ {\r
+ try\r
+ {\r
+ /* TEST CODE */\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ try\r
+ {\r
+ var task = nlp.Connect();\r
+ await task;\r
+ await Task.Delay(30);\r
+ }\r
+ catch\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "nlp has connected");\r
+ }\r
+ PosTagResult res;\r
+ string msg = "This is a test case of the NLP project.";\r
+ res = await nlp.PosTagAsync(msg);\r
+ IList<string> rs_tag = new List<string>();\r
+ rs_tag.Add("DT");\r
+ rs_tag.Add("VBZ");\r
+ rs_tag.Add("DT");\r
+ rs_tag.Add("NN");\r
+ rs_tag.Add("NN");\r
+ rs_tag.Add("IN");\r
+ rs_tag.Add("DT");\r
+ rs_tag.Add("NNP");\r
+ rs_tag.Add("NN");\r
+ rs_tag.Add(".");\r
+ for (int i = 0; i < res.Tags.Count; i++)\r
+ Assert.IsTrue(res.Tags[i].Equals(rs_tag[i]), "The return value of tag is correct");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the return value of PosTagResult Tokens is correct or not")]\r
+ [Property("SPEC", "Tizen.Nlp.PosTagResult.Tokens A")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "PRO")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task Tokens_RETURN_VALUE()\r
+ {\r
+ try\r
+ {\r
+ /* TEST CODE */\r
+ if (nlp == null)\r
+ nlp = new NaturalLanguageProcess();\r
+ try\r
+ {\r
+ var task = nlp.Connect();\r
+ await task;\r
+ await Task.Delay(30);\r
+ }\r
+ catch\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "nlp has connected");\r
+ }\r
+ PosTagResult res;\r
+ string msg = "This is a test case of the NLP project.";\r
+ res = await nlp.PosTagAsync(msg);\r
+ IList<string> rs_token = new List<string>(); ;\r
+ rs_token.Add("This");\r
+ rs_token.Add("is");\r
+ rs_token.Add("a");\r
+ rs_token.Add("test");\r
+ rs_token.Add("case");\r
+ rs_token.Add("of");\r
+ rs_token.Add("the");\r
+ rs_token.Add("NLP");\r
+ rs_token.Add("project");\r
+ rs_token.Add(".");\r
+ for (int i = 0; i < res.Tokens.Count; i++)\r
+ Assert.IsTrue(res.Tokens[i].Equals(rs_token[i]), "The return token value of token is correct");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+ }\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License\r
+ */\r
+\r
+using NUnit.Framework;\r
+using NUnit.Framework.TUnit;\r
+using System;\r
+using System.Threading;\r
+using System.Threading.Tasks;\r
+using System.Collections.Generic;\r
+using Tizen;\r
+using Tizen.Nlp;\r
+using Tizen.Applications;\r
+using Tizen.Applications.Messages;\r
+\r
+namespace Tizen.Nlp.Tests {\r
+\r
+ [TestFixture]\r
+ [Description("Tizen.Nlp.WordTokenizeResult test")]\r
+ public class WordTokenizeResultTests\r
+ {\r
+\r
+ [SetUp]\r
+ public static void Init()\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Preconditions for each TEST");\r
+ }\r
+\r
+ [TearDown]\r
+ public static void Destroy()\r
+ {\r
+ LogUtils.Write(LogUtils.DEBUG , LogUtils.TAG , "Postconditions for each TEST");\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Test: Check if constructor for the class returns correct object instance")]\r
+ [Property("SPEC", "Tizen.Nlp.WordTokenizeResult.WordTokenizeResult C")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "CONSTR")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static void WordTokenizeResult_INIT()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+ WordTokenizeResult res = new WordTokenizeResult();\r
+ Assert.IsInstanceOf<WordTokenizeResult>(res, "Expecting WordTokenizeResult object");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+\r
+ [Test]\r
+ [Category("P1")]\r
+ [Description("Check the return value of WordTokenizeResult Tokens is correct or not")]\r
+ [Property("SPEC", "Tizen.Nlp.WordTokenizeResult.Tokens A")]\r
+ [Property("SPEC_URL", "-")]\r
+ [Property("CRITERIA", "PRO")]\r
+ [Property("AUTHOR", "Xiaochun wang, xiaochn.wang@samsung.com")]\r
+ public static async Task Tokens_RETURN_VALUE()\r
+ {\r
+ /* TEST CODE */\r
+ try\r
+ {\r
+ NaturalLanguageProcess nlp = new NaturalLanguageProcess();\r
+ await nlp.Connect();\r
+ await Task.Delay(30);\r
+ WordTokenizeResult res;\r
+ string msg = "This is a test case of the NLP project.";\r
+ res = await nlp.WordTokenizeAsync(msg);\r
+ IList<string> rs_token = new List<string>();\r
+ rs_token.Add("This");\r
+ rs_token.Add("is");\r
+ rs_token.Add("a");\r
+ rs_token.Add("test");\r
+ rs_token.Add("case");\r
+ rs_token.Add("of");\r
+ rs_token.Add("the");\r
+ rs_token.Add("NLP");\r
+ rs_token.Add("project");\r
+ rs_token.Add(".");\r
+ for (int i = 0; i < res.Tokens.Count; i++)\r
+ Assert.IsTrue(res.Tokens[i].Equals(rs_token[i]), "The return token value of token is correct");\r
+ }\r
+ catch (Exception e)\r
+ {\r
+ Assert.Fail("Got Exception" + e.ToString());\r
+ }\r
+ }\r
+ }\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest package="Tizen.Nlp.Tests" version="1.0.0" api-version="5" xmlns="http://tizen.org/ns/packages">
+ <profile name="common" />
+ <ui-application appid="Tizen.Nlp.Tests" exec="Tizen.Nlp.Tests.dll" multiple="false" taskmanage="true" splash-screen-display="true" type="dotnet" launch_mode="single">
+ <icon>Tizen.Nlp.Tests.png</icon>
+ <label>Tizen.Nlp.Tests</label>
+ <splash-screens />
+ </ui-application>
+ <shortcut-list />
+ <privileges>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ <privilege>http://tizen.org/privilege/datasharing</privilege>
+ <privilege>http://tizen.org/privilege/apphistory.read</privilege>
+ </privileges>
+ <provides-appdefined-privileges />
+</manifest>