diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting')
9 files changed, 9 insertions, 293 deletions
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 @@ <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.1.1.2" newVersion="4.1.1.2" /> </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> - </dependentAssembly> </assemblyBinding> </runtime> <system.data> 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<RemoteDataStoreGetResponse>(response, PMR.Integration.GenericMessageProtocol.Bson); - - RemoteDataStoreGetResponse des = GenericMessageSerializer.Deserialize<RemoteDataStoreGetResponse>(data, PMR.Integration.GenericMessageProtocol.Bson); - - CalculateRequest cc = des.ProtoObject.Message as CalculateRequest; - - Assert.AreEqual<CalculateRequest>(calc, cc); - } - - private void Run_Test(IDataStoreManager manager) - { - 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); - } - - { - collection.Put<CalculateRequest>("calc", new CalculateRequest() { A = 10, B = 15 }); - CalculateRequest value = collection.Get<CalculateRequest>("calc"); - Assert.AreEqual<CalculateRequest>(value, new CalculateRequest() { A = 10, B = 15 }); - } - - Assert.IsTrue(collection.Count() == 7); - - 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() == 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 @@ <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" /> <Compile Include="MachineService\PPC_Controller_TST.cs" /> <Compile Include="MachineStudio\MachineStudio_TST.cs" /> <Compile Include="Pulse\Pulse_TST.cs" /> @@ -173,21 +171,9 @@ <None Include="packages.config" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\DataStore\Tango.DataStore.EF\Tango.DataStore.EF.csproj"> - <Project>{88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4}</Project> - <Name>Tango.DataStore.EF</Name> - </ProjectReference> - <ProjectReference Include="..\DataStore\Tango.DataStore.LiteDB\Tango.DataStore.Lite.csproj"> - <Project>{fa96bc0c-4055-475c-9dcc-70a5a9436b10}</Project> - <Name>Tango.DataStore.Lite</Name> - </ProjectReference> - <ProjectReference Include="..\DataStore\Tango.DataStore.Remote\Tango.DataStore.Remote.csproj"> - <Project>{29448f3c-9b3e-4da6-8555-46a8b9a6b3aa}</Project> - <Name>Tango.DataStore.Remote</Name> - </ProjectReference> - <ProjectReference Include="..\DataStore\Tango.DataStore\Tango.DataStore.csproj"> - <Project>{e0364dfa-0721-4637-9d32-9d22aac109d6}</Project> - <Name>Tango.DataStore</Name> + <ProjectReference Include="..\MachineStudio\Modules\Tango.MachineStudio.ColorLab\Tango.MachineStudio.ColorLab.csproj"> + <Project>{4d183aca-552b-4135-ae81-7c5a8e5fc3b1}</Project> + <Name>Tango.MachineStudio.ColorLab</Name> </ProjectReference> <ProjectReference Include="..\MachineStudio\Modules\Tango.MachineStudio.Logging\Tango.MachineStudio.Logging.csproj"> <Project>{1674f726-0e66-414f-b9fd-c6f20d7f07c7}</Project> |
