From 00a491d93733d4625ad329b2ba8237f445364b3f Mon Sep 17 00:00:00 2001 From: Mirta Date: Wed, 30 Dec 2020 16:39:52 +0200 Subject: merge --- .../Visual_Studio/Tango.UnitTesting/App.config | 4 - .../Visual_Studio/Tango.UnitTesting/BL/DTO_TST.cs | 12 -- .../Tango.UnitTesting/DataStore/DataStore_TST.cs | 123 --------------------- .../Tango.UnitTesting/Logging/Parsing_TST.cs | 22 ---- .../Tango.UnitTesting/Logging/SessionLoging_TST.cs | 38 ------- .../MachineService/PPC_Controller_TST.cs | 5 +- .../Tango.UnitTesting/RemoteRunner_TST.cs | 7 +- .../SQLExaminer/SQLExaminer_TST.cs | 71 ------------ .../Tango.UnitTesting/Tango.UnitTesting.csproj | 20 +--- 9 files changed, 9 insertions(+), 293 deletions(-) delete mode 100644 Software/Visual_Studio/Tango.UnitTesting/DataStore/DataStore_TST.cs delete mode 100644 Software/Visual_Studio/Tango.UnitTesting/Logging/SessionLoging_TST.cs (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/Visual_Studio/Tango.UnitTesting/App.config b/Software/Visual_Studio/Tango.UnitTesting/App.config index 0641554af..0490d020e 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/App.config +++ b/Software/Visual_Studio/Tango.UnitTesting/App.config @@ -121,10 +121,6 @@ - - - - diff --git a/Software/Visual_Studio/Tango.UnitTesting/BL/DTO_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/BL/DTO_TST.cs index a574f7ea0..58a05ee83 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/BL/DTO_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/BL/DTO_TST.cs @@ -38,17 +38,5 @@ namespace Tango.UnitTesting.BL Assert.IsTrue(configDTO.Equals(config)); } } - - [TestMethod] - public void DTOPropertyAttribute_Is_Working() - { - using (ObservablesContext db = ObservablesContext.CreateDefault()) - { - var hwBlower = db.HardwareBlowers.Include(x => x.HardwareBlowerType).First(); - var dto = HardwareBlowerDTO.FromObservable(hwBlower); - - Assert.AreEqual(dto.HardwareBlowerTypeDescription, hwBlower.HardwareBlowerType.Description); - } - } } } diff --git a/Software/Visual_Studio/Tango.UnitTesting/DataStore/DataStore_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/DataStore/DataStore_TST.cs deleted file mode 100644 index 594c8d7f8..000000000 --- a/Software/Visual_Studio/Tango.UnitTesting/DataStore/DataStore_TST.cs +++ /dev/null @@ -1,123 +0,0 @@ -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; -using Tango.DataStore.EF; -using Tango.PMR.Stubs; -using Tango.Transport; -using Tango.DataStore.Remote; - -namespace Tango.UnitTesting.DataStore -{ - [TestClass] - [TestCategory("DataStore")] - public class DataStore_TST - { - [TestMethod] - public void LiteDB_DataStore_Working() - { - var tempFile = TemporaryManager.Default.CreateImaginaryFile(); - Run_Test(new LiteDBDataStoreManager(tempFile)); - tempFile.Delete(); - } - - [TestMethod] - public void EF_DataStore_Working() - { - Run_Test(new EFDataStoreManager()); - } - - [TestMethod] - public void Remote_Data_Store_Working() - { - CalculateRequest calc = new CalculateRequest() - { - A = 10, - B = 15, - }; - - RemoteDataStoreGetResponse response = new RemoteDataStoreGetResponse(); - response.ProtoObject = DataStoreProtoObject.FromMessage(calc); - - byte[] data = GenericMessageSerializer.Serialize(response, PMR.Integration.GenericMessageProtocol.Bson); - - RemoteDataStoreGetResponse des = GenericMessageSerializer.Deserialize(data, PMR.Integration.GenericMessageProtocol.Bson); - - CalculateRequest cc = des.ProtoObject.Message as CalculateRequest; - - Assert.AreEqual(calc, cc); - } - - private void Run_Test(IDataStoreManager manager) - { - 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); - } - - { - collection.Put("calc", new CalculateRequest() { A = 10, B = 15 }); - CalculateRequest value = collection.Get("calc"); - Assert.AreEqual(value, new CalculateRequest() { A = 10, B = 15 }); - } - - Assert.IsTrue(collection.Count() == 7); - - 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() == 5); - - collection.DeleteAll(); - Assert.IsTrue(collection.Count() == 0); - - manager.Dispose(); - } - } -} diff --git a/Software/Visual_Studio/Tango.UnitTesting/Logging/Parsing_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Logging/Parsing_TST.cs index 8cc87e700..57856f9cb 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Logging/Parsing_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/Logging/Parsing_TST.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; -using System.Threading; using System.Threading.Tasks; using Tango.Integration.Logging; using Tango.Logging; @@ -31,26 +30,5 @@ namespace Tango.UnitTesting.Logging var logFile = logFiles.OrderByDescending(x => x.DateTime).First(); var logs = parser.Parse(logFile); } - - [TestMethod] - public void Parse_Multi_Part_Log_Files() - { - var manager = LogManager.Default; - var fileLogger = new FileLogger(); - var folder = FileLogger.DefaultLogsFolder; - fileLogger.EnableMaxFileSizeLimit = true; - fileLogger.MaxFileSizeLimit = 10000; - LogManager.Default.RegisterLogger(fileLogger); - for (int i = 0; i < 100; i++) - { - manager.Log($"This is a test {i}"); - Thread.Sleep(100); - } - Thread.Sleep(1000); - ApplicationLogFileParser parser = new ApplicationLogFileParser(); - var logFiles = parser.GetLogFiles(); - var logFile = logFiles.OrderByDescending(x => x.DateTime).First(); - var logs = parser.Parse(logFile); - } } } diff --git a/Software/Visual_Studio/Tango.UnitTesting/Logging/SessionLoging_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Logging/SessionLoging_TST.cs deleted file mode 100644 index 873fcca57..000000000 --- a/Software/Visual_Studio/Tango.UnitTesting/Logging/SessionLoging_TST.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Tango.Logging; - -namespace Tango.UnitTesting.Logging -{ - [TestClass] - [TestCategory("Logging")] - public class SessionLoging_TST - { - [TestMethod] - public void Create_Session_File_Logger() - { - SessionFileLogger sessionlogger = new SessionFileLogger(); - LogManager.Default.RegisterLogger(sessionlogger); - sessionlogger.CreateSession(); - var manager = LogManager.Default; - - manager.Log($"This is a test 1"); - Thread.Sleep(300); - SessionFileLogger slogger = LogManager.Default.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(SessionFileLogger)) as SessionFileLogger; - string[] fileEntries = Directory.GetFiles(slogger.Folder, "*.log"); - Assert.AreEqual(1, fileEntries.Count()); - - sessionlogger.CreateSession(); - manager.Log($"This is a test 2"); - Thread.Sleep(300); - fileEntries = Directory.GetFiles(slogger.Folder, "*.log"); - Assert.AreEqual(1, fileEntries.Count()); - } - } -} 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 651b46835..68232e512 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/MachineService/PPC_Controller_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/MachineService/PPC_Controller_TST.cs @@ -56,7 +56,10 @@ namespace Tango.UnitTesting.MachineService }).Result; //Should return setup information - var res5 = client.MachineSetup(new MachineSetupRequest()).GetAwaiter().GetResult(); + var res5 = client.MachineSetup(new MachineSetupRequest() + { + SerialNumber = "0003", + }).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 948bc630b..0fdd437f0 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,10 +80,7 @@ namespace Tango.UnitTesting { UploadID = uploadResponse.UploadID, FileName = executeFileName, - }, new TransportRequestConfig() - { - Timeout = TimeSpan.FromSeconds(30), - }).Result.Message; + }, TimeSpan.FromSeconds(30)).Result.Message; Thread.Sleep(5000); diff --git a/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer/SQLExaminer_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer/SQLExaminer_TST.cs index e3e49ac5e..9b0385c23 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer/SQLExaminer_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer/SQLExaminer_TST.cs @@ -391,76 +391,5 @@ namespace Tango.UnitTesting.SQLExaminer //Should have no differences! Assert.IsFalse(data_report.HasDifferences); } - - [TestMethod] - public void Perform_Machine_Update_From_Backup() - { - String tempDbName = "Tango_TUP"; - - var source_db = GetSource("Tango"); - var target_db = GetSource(tempDbName); - - DbManager dbManager = DbManager.FromDataSource(source_db); - - //Create the backup for the tup file. - dbManager.Create(tempDbName); - - var configuration = GetFullConfiguration(); - - ExaminerSequenceConfigurationRunner runner = - new ExaminerSequenceConfigurationRunner( - configuration, - Tango.SQLExaminer.Helper.SQL_EXAMINER_CONFIG_FOLDER, - source_db, - target_db, - "1111"); - - runner.Run().GetAwaiter().GetResult(); - - String backupFile = "C:\\DB_Backups\\Tango_TEMP.bak"; - - dbManager.Backup(tempDbName, backupFile); - dbManager.SetOffline(tempDbName); - dbManager.SetOnline(tempDbName); - dbManager.Delete(tempDbName); - - //Now restore as different name - dbManager.RestoreAsNew(tempDbName, backupFile, "C:\\DB_Backups"); - } - - private ExaminerSequenceConfiguration GetFullConfiguration() - { - ExaminerSequenceConfiguration configuration = new ExaminerSequenceConfiguration(); - - configuration.Items.Add(new ExaminerSequenceItem() - { - Type = ExaminerSequenceItemType.Schema, - Direction = ExaminerSequenceItemDirection.SourceToTarget, - FileName = ExaminerConfigurationType.Schema.GetFileName(), - Index = 0, - Name = "Updating Schema", - }); - - configuration.Items.Add(new ExaminerSequenceItem() - { - Type = ExaminerSequenceItemType.Data, - Direction = ExaminerSequenceItemDirection.SourceToTarget, - FileName = ExaminerConfigurationType.OverrideData.GetFileName(), - Index = 1, - Name = "Updating Collections", - }); - - configuration.Items.Add(new ExaminerSequenceItem() - { - Type = ExaminerSequenceItemType.Data, - Direction = ExaminerSequenceItemDirection.SourceToTarget, - FileName = ExaminerConfigurationType.ProvisionMachine.GetFileName(), - Index = 2, - Name = "Configuring Machine", - RequiresSerialNumber = true, - }); - - return configuration; - } } } diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index 4d76daabc..05daac6c7 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -138,10 +138,8 @@ - - @@ -173,21 +171,9 @@ - - {88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4} - Tango.DataStore.EF - - - {fa96bc0c-4055-475c-9dcc-70a5a9436b10} - Tango.DataStore.Lite - - - {29448f3c-9b3e-4da6-8555-46a8b9a6b3aa} - Tango.DataStore.Remote - - - {e0364dfa-0721-4637-9d32-9d22aac109d6} - Tango.DataStore + + {4d183aca-552b-4135-ae81-7c5a8e5fc3b1} + Tango.MachineStudio.ColorLab {1674f726-0e66-414f-b9fd-c6f20d7f07c7} -- cgit v1.3.1