diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-10-20 20:58:32 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-10-20 20:58:32 +0300 |
| commit | 50b5a229c4fe547a896539f24c96e5e9a86ebb80 (patch) | |
| tree | 653f78a466296564862e5bcba38422284f693545 /Software/Visual_Studio/Tango.UnitTesting | |
| parent | b732167cbc51f0b19447d67687af5c514cf4f65a (diff) | |
| download | Tango-50b5a229c4fe547a896539f24c96e5e9a86ebb80.tar.gz Tango-50b5a229c4fe547a896539f24c96e5e9a86ebb80.zip | |
DATA STORE !
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting')
4 files changed, 98 insertions, 7 deletions
diff --git a/Software/Visual_Studio/Tango.UnitTesting/DataStore/DataStore_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/DataStore/DataStore_TST.cs new file mode 100644 index 000000000..4a7d55e1e --- /dev/null +++ b/Software/Visual_Studio/Tango.UnitTesting/DataStore/DataStore_TST.cs @@ -0,0 +1,82 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR; +using Tango.PMR.Embroidery; +using Tango.DataStore; +using Tango.DataStore.Lite; +using Tango.Core.IO; + +namespace Tango.UnitTesting.DataStore +{ + [TestClass] + [TestCategory("DataStore")] + public class DataStore_TST + { + [TestMethod] + public void LiteDB_DataStore_Working() + { + var tempFile = TemporaryManager.Default.CreateImaginaryFile(); + IDataStoreManager manager = new LiteDBDataStoreManager(tempFile); + IDataStoreCollection collection = manager.GetCollection("TEST"); + + { + collection.Put<int>("int", 10); + int value = collection.Get<int>("int"); + Assert.AreEqual<int>(value, 10); + } + + { + collection.Put<float>("float", 10f); + float value = collection.Get<float>("float"); + Assert.AreEqual<float>(value, 10f); + } + + { + collection.Put<double>("double", 10d); + double value = collection.Get<double>("double"); + Assert.AreEqual<double>(value, 10d); + } + + { + collection.Put<bool>("bool", true); + bool value = collection.Get<bool>("bool"); + Assert.AreEqual<bool>(value, true); + } + + { + collection.Put<string>("string", "some value"); + string value = collection.Get<string>("string"); + Assert.AreEqual<string>(value, "some value"); + } + + { + collection.Put<byte[]>("bytes", new byte[] { 255 }); + byte[] value = collection.Get<byte[]>("bytes"); + Assert.AreEqual<byte>(value[0], 255); + } + + Assert.IsTrue(collection.Count() == 6); + + Assert.ThrowsException<NotSupportedException>(() => collection.Put<DataStore_TST>("somekey", this)); + + collection.Delete("int"); + Assert.ThrowsException<KeyNotFoundException>(() => collection.Get<int>("int")); + + collection.Delete("float"); + Assert.ThrowsException<KeyNotFoundException>(() => collection.Get<float>("float")); + + Assert.IsTrue(collection.Count() == 4); + + collection.DeleteAll(); + Assert.IsTrue(collection.Count() == 0); + + manager.Dispose(); + tempFile.Delete(); + } + } +} diff --git a/Software/Visual_Studio/Tango.UnitTesting/MachineService/PPC_Controller_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/MachineService/PPC_Controller_TST.cs index 68232e512..651b46835 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/MachineService/PPC_Controller_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/MachineService/PPC_Controller_TST.cs @@ -56,10 +56,7 @@ namespace Tango.UnitTesting.MachineService }).Result; //Should return setup information - var res5 = client.MachineSetup(new MachineSetupRequest() - { - SerialNumber = "0003", - }).GetAwaiter().GetResult(); + var res5 = client.MachineSetup(new MachineSetupRequest()).GetAwaiter().GetResult(); //Now get DEV data source using the machine studio client in order to validate the setup information. Tango.MachineStudio.Common.Web.MachineStudioWebClient msClient = new Tango.MachineStudio.Common.Web.MachineStudioWebClient(address, null); diff --git a/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs index 0fdd437f0..948bc630b 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/RemoteRunner_TST.cs @@ -20,7 +20,7 @@ namespace Tango.UnitTesting { [TestClass] [TestCategory("Remote Runner")] - public class RemoteRunner_TST + public class RemoteRunner_TST { [TestMethod] public void Run_Remote_Runner_Connect_Upload_And_Execute_Process() @@ -80,7 +80,10 @@ namespace Tango.UnitTesting { UploadID = uploadResponse.UploadID, FileName = executeFileName, - }, TimeSpan.FromSeconds(30)).Result.Message; + }, new TransportRequestConfig() + { + Timeout = TimeSpan.FromSeconds(30), + }).Result.Message; Thread.Sleep(5000); diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index 09799c0ed..218652c1b 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -138,6 +138,7 @@ <Compile Include="AdvancedInstaller\AdvancedInstaller_TST.cs" /> <Compile Include="BL\DTO_TST.cs" /> <Compile Include="BL\HardwareConfiguration_TST.cs" /> + <Compile Include="DataStore\DataStore_TST.cs" /> <Compile Include="Integration\JobDescriptionFile_TST.cs" /> <Compile Include="Logging\Parsing_TST.cs" /> <Compile Include="Logging\SessionLoging_TST.cs" /> @@ -212,6 +213,14 @@ <Project>{38197109-8610-4d3f-92b9-16d48df94d7c}</Project> <Name>Tango.DAL.Remote</Name> </ProjectReference> + <ProjectReference Include="..\Tango.DataStore.LiteDB\Tango.DataStore.Lite.csproj"> + <Project>{fa96bc0c-4055-475c-9dcc-70a5a9436b10}</Project> + <Name>Tango.DataStore.Lite</Name> + </ProjectReference> + <ProjectReference Include="..\Tango.DataStore\Tango.DataStore.csproj"> + <Project>{e0364dfa-0721-4637-9d32-9d22aac109d6}</Project> + <Name>Tango.DataStore</Name> + </ProjectReference> <ProjectReference Include="..\Tango.Documents\Tango.Documents.csproj"> <Project>{ca87a608-7b17-4c98-88f2-42abee10f4c1}</Project> <Name>Tango.Documents</Name> @@ -306,7 +315,7 @@ <Import Project="..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file |
