From 50b5a229c4fe547a896539f24c96e5e9a86ebb80 Mon Sep 17 00:00:00 2001 From: Roy Ben Shabat Date: Tue, 20 Oct 2020 20:58:32 +0300 Subject: DATA STORE ! --- .../Tango.UnitTesting/DataStore/DataStore_TST.cs | 82 ++++++++++++++++++++++ .../MachineService/PPC_Controller_TST.cs | 5 +- .../Tango.UnitTesting/RemoteRunner_TST.cs | 7 +- .../Tango.UnitTesting/Tango.UnitTesting.csproj | 11 ++- 4 files changed, 98 insertions(+), 7 deletions(-) create mode 100644 Software/Visual_Studio/Tango.UnitTesting/DataStore/DataStore_TST.cs (limited to 'Software/Visual_Studio/Tango.UnitTesting') 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", 10); + int value = collection.Get("int"); + Assert.AreEqual(value, 10); + } + + { + collection.Put("float", 10f); + float value = collection.Get("float"); + Assert.AreEqual(value, 10f); + } + + { + collection.Put("double", 10d); + double value = collection.Get("double"); + Assert.AreEqual(value, 10d); + } + + { + collection.Put("bool", true); + bool value = collection.Get("bool"); + Assert.AreEqual(value, true); + } + + { + collection.Put("string", "some value"); + string value = collection.Get("string"); + Assert.AreEqual(value, "some value"); + } + + { + collection.Put("bytes", new byte[] { 255 }); + byte[] value = collection.Get("bytes"); + Assert.AreEqual(value[0], 255); + } + + Assert.IsTrue(collection.Count() == 6); + + Assert.ThrowsException(() => collection.Put("somekey", this)); + + collection.Delete("int"); + Assert.ThrowsException(() => collection.Get("int")); + + collection.Delete("float"); + Assert.ThrowsException(() => collection.Get("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 @@ + @@ -212,6 +213,14 @@ {38197109-8610-4d3f-92b9-16d48df94d7c} Tango.DAL.Remote + + {fa96bc0c-4055-475c-9dcc-70a5a9436b10} + Tango.DataStore.Lite + + + {e0364dfa-0721-4637-9d32-9d22aac109d6} + Tango.DataStore + {ca87a608-7b17-4c98-88f2-42abee10f4c1} Tango.Documents @@ -306,7 +315,7 @@ - + \ No newline at end of file -- cgit v1.3.1