diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-01-02 08:47:29 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-01-02 08:47:29 +0200 |
| commit | 520e878bf98efcec9c75abcfe483175ff72620a2 (patch) | |
| tree | 62a7221e3c22187821f6a5e399eca0f7bd31168a /Software/Visual_Studio/Tango.UnitTesting | |
| parent | 30574fe4a6e1bb4f60a43e9000acaf919811689a (diff) | |
| parent | 25f5e6ddef7ef2fa0a747305847eeb4ceee5a2c9 (diff) | |
| download | Tango-520e878bf98efcec9c75abcfe483175ff72620a2.tar.gz Tango-520e878bf98efcec9c75abcfe483175ff72620a2.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting')
6 files changed, 73 insertions, 51 deletions
diff --git a/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs index 0ea7b59ef..02862350f 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs @@ -17,24 +17,20 @@ namespace Tango.UnitTesting { String guid = Guid.NewGuid().ToString(); - using (var db = new DAL.Remote.DB.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource)) - { - var action = new DAL.Remote.DB.ACTION_TYPES(); - action.CODE = 1; - action.NAME = "Action 1"; - action.DESCRIPTION = "Description 1"; - action.GUID = guid; - action.LAST_UPDATED = DateTime.UtcNow; + DataSource s = new DataSource(); + s.Type = DataSourceType.SQLServer; + s.Address = "twine.database.windows.net"; + s.Catalog = "Tango"; + s.IntegratedSecurity = false; + s.UserName = "Roy"; + s.Password = "Aa123456"; - db.ACTION_TYPES.Add(action); - db.SaveChanges(); - } - using (var db = new DAL.Remote.DB.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource)) + using (var db = new DAL.Remote.DB.RemoteDB(s)) { - var action = db.ACTION_TYPES.Single(x => x.GUID == guid); - db.ACTION_TYPES.Remove(action); - db.SaveChanges(); + var events = db.EVENT_TYPES.ToList(); + var motors = db.HARDWARE_MOTOR_TYPES.ToList(); + var monitors = db.TECH_MONITORS.ToList(); } } diff --git a/Software/Visual_Studio/Tango.UnitTesting/Logging_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Logging_TST.cs index 6d95674ff..c4a697715 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Logging_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/Logging_TST.cs @@ -4,7 +4,8 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -using Tango.MachineStudio.Logging.Parsing; +using Tango.Integration.Logging; +using Tango.Logging; namespace Tango.UnitTesting { diff --git a/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs index 4afa31edf..0edab542a 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.PMR.Synchronization; +using Tango.PPC.Common.MachineUpdate; using Tango.Transport.Web; namespace Tango.UnitTesting @@ -16,8 +17,8 @@ namespace Tango.UnitTesting [TestMethod] public void Check_For_Updates() { - ITransportWebClient client = new ProtoWebClient(); - var result = client.Post<CheckForUpdateRequest, CheckForUpdateResponse>("http://localhost:51581/api/Synchronization/CheckForUpdate", new CheckForUpdateRequest() + IWebTransportClient client = new WebTransportClient(); + var result = client.PostJson<CheckForUpdateRequest, CheckForUpdateResponse>("http://localhost:51581/api/PPC/CheckForUpdate", new CheckForUpdateRequest() { SerialNumber = "0000", Version = "0.0.0.0", diff --git a/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs index 5b7ce16ca..e914c0807 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/SQLExaminer_TST.cs @@ -20,6 +20,28 @@ namespace Tango.UnitTesting [TestCategory("SQL Examiner")] public class SQLExaminer_TST { + private Core.DataSource GetSource(String catalog = "Tango") + { + return new Core.DataSource() + { + Type = DataSourceType.SQLServer, + Address = "localhost\\SQLEXPRESS", + Catalog = catalog, + IntegratedSecurity = true, + }; + } + + private Core.DataSource GetTarget(String catalog = "Test") + { + return new Core.DataSource() + { + Type = DataSourceType.SQLServer, + Address = "localhost\\SQLEXPRESS", + Catalog = catalog, + IntegratedSecurity = true, + }; + } + [TestMethod] public void Generate_Schema_Synchronization_Script() { @@ -28,8 +50,8 @@ namespace Tango.UnitTesting var temp_folder = Helper.GetTempFolderPath(); builder. - SetSourceServer("localhost\\SQLEXPRESS", "Tango", false, "Synchronizer", "Aa123456"). - SetTargetServer("twine01\\SQLTWINE", "Tango"). + SetSource(GetSource()). + SetTarget(GetTarget()). SetBackupFile(Path.Combine(temp_folder, "db.bak")). SetReportFile(Path.Combine(temp_folder, "report.xml")); @@ -50,8 +72,8 @@ namespace Tango.UnitTesting var temp_folder = Helper.GetTempFolderPath(); builder. - SetSourceServer("localhost\\SQLEXPRESS", "Tango", false, "Synchronizer", "Aa123456"). - SetTargetServer("twine01\\SQLTWINE", "Tango"). + SetSource(GetSource()). + SetTarget(GetTarget()). SetReportFile(Path.Combine(temp_folder, "report.xml")). SetMachineSerialNumber("1111"); @@ -72,8 +94,8 @@ namespace Tango.UnitTesting var temp_folder = Helper.GetTempFolderPath(); builder. - SetSourceServer("localhost\\SQLEXPRESS", "Tango", false, "Synchronizer", "Aa123456"). - SetTargetServer("twine01\\SQLTWINE", "Tango"). + SetSource(GetSource()). + SetTarget(GetTarget()). SetReportFile(Path.Combine(temp_folder, "report.xml")); var config = builder.Build(); @@ -101,8 +123,8 @@ namespace Tango.UnitTesting var temp_folder = Helper.GetTempFolderPath(); builder. - SetSourceServer("localhost\\SQLEXPRESS", "Tango"). - SetTargetServer("localhost\\SQLEXPRESS", "Test"). + SetSource(GetSource()). + SetTarget(GetTarget()). SetReportFile("C:\\Data\\Report.xml"); var config = builder.Build(); @@ -125,8 +147,8 @@ namespace Tango.UnitTesting var temp_folder = Helper.GetTempFolderPath(); builder. - SetSourceServer("localhost\\SQLEXPRESS", "Tango"). - SetTargetServer("localhost\\SQLEXPRESS", "Test"). + SetSource(GetSource()). + SetTarget(GetTarget()). SetReportFile("C:\\DATA\\report_data.xml"); var config = builder.Build(); @@ -153,8 +175,8 @@ namespace Tango.UnitTesting var temp_folder = Helper.GetTempFolderPath(); builder. - SetSourceServer("localhost\\SQLEXPRESS", "Tango"). - SetTargetServer("localhost\\SQLEXPRESS", "Test"). + SetSource(GetSource()). + SetTarget(GetTarget()). SetMachineSerialNumber("1111"); var config = builder.Build(); @@ -216,8 +238,8 @@ namespace Tango.UnitTesting ExaminerConfigurationBuilder builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.Schema); builder. - SetSourceServer("localhost\\SQLEXPRESS", source_db). - SetTargetServer("localhost\\SQLEXPRESS", target_db). + SetSource(GetSource(source_db)). + SetTarget(GetTarget(target_db)). Synchronize(). SetReportFile(report_file); @@ -236,8 +258,8 @@ namespace Tango.UnitTesting builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.OverrideData); builder. - SetSourceServer("localhost\\SQLEXPRESS", source_db). - SetTargetServer("localhost\\SQLEXPRESS", target_db). + SetSource(GetSource(source_db)). + SetTarget(GetTarget(target_db)). Synchronize(). SetReportFile(report_file); @@ -255,8 +277,8 @@ namespace Tango.UnitTesting builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.ProvisionMachine); builder. - SetSourceServer("localhost\\SQLEXPRESS", source_db). - SetTargetServer("localhost\\SQLEXPRESS", target_db). + SetSource(GetSource(source_db)). + SetTarget(GetTarget(target_db)). SetMachineSerialNumber(machine_serial_number). Synchronize(). SetReportFile(report_file); @@ -308,8 +330,8 @@ namespace Tango.UnitTesting builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.UpdateTwineDB); builder. - SetSourceServer("localhost\\SQLEXPRESS", target_db). - SetTargetServer("localhost\\SQLEXPRESS", source_db). + SetSource(GetTarget(target_db)). + SetTarget(GetSource(source_db)). Synchronize(). SetReportFile(report_file); @@ -333,7 +355,6 @@ namespace Tango.UnitTesting using (var context = ObservablesContext.CreateDefault("localhost\\SQLEXPRESS", source_db, DataSourceType.SQLServer)) { var machine = context.Machines.SingleOrDefault(x => x.SerialNumber == machine_serial_number); - machine.Configuration.Name = "Test Name " + new Random().Next(0, 1000); context.SaveChanges(); } @@ -341,8 +362,8 @@ namespace Tango.UnitTesting builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.UpdateMachine); builder. - SetSourceServer("localhost\\SQLEXPRESS", source_db). - SetTargetServer("localhost\\SQLEXPRESS", target_db). + SetSource(GetSource(source_db)). + SetTarget(GetTarget(target_db)). SetMachineSerialNumber(machine_serial_number). Synchronize(). SetReportFile(report_file); diff --git a/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs index d6713c2ac..960cacf44 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs @@ -84,7 +84,6 @@ namespace Tango.UnitTesting APPLICATION_DISPLAY_PANEL_VERSIONS = new remote.APPLICATION_DISPLAY_PANEL_VERSIONS() { GUID = Guid.NewGuid().ToString(), LAST_UPDATED = DateTime.UtcNow }, APPLICATION_FIRMWARE_VERSIONS = new remote.APPLICATION_FIRMWARE_VERSIONS() { GUID = Guid.NewGuid().ToString(), LAST_UPDATED = DateTime.UtcNow }, APPLICATION_OS_VERSIONS = new remote.APPLICATION_OS_VERSIONS() { GUID = Guid.NewGuid().ToString(), LAST_UPDATED = DateTime.UtcNow }, - CREATION_DATE = DateTime.UtcNow, EMBEDDED_FIRMWARE_VERSIONS = new remote.EMBEDDED_FIRMWARE_VERSIONS() { GUID = Guid.NewGuid().ToString(), LAST_UPDATED = DateTime.UtcNow }, HARDWARE_VERSIONS = new remote.HARDWARE_VERSIONS() { GUID = Guid.NewGuid().ToString(), LAST_UPDATED = DateTime.UtcNow }, }; @@ -106,16 +105,16 @@ namespace Tango.UnitTesting MACHINE_VERSIONS = machine_version, }; - var machine_configuration = new remote.MACHINES_CONFIGURATIONS() - { - GUID = Guid.NewGuid().ToString(), - LAST_UPDATED = DateTime.UtcNow, - CONFIGURATION = configuration, - MACHINE = machine, - }; + //var machine_configuration = new remote.MACHINES_CONFIGURATIONS() + //{ + // GUID = Guid.NewGuid().ToString(), + // LAST_UPDATED = DateTime.UtcNow, + // CONFIGURATION = configuration, + // MACHINE = machine, + //}; remoteDB.MACHINES.Add(machine); - remoteDB.MACHINES_CONFIGURATIONS.Add(machine_configuration); + //remoteDB.MACHINES_CONFIGURATIONS.Add(machine_configuration); remoteDB.SaveChanges(); } diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index aa8b71dd1..6c547102c 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -128,6 +128,10 @@ <Project>{cb0b0aa2-bb24-4bca-a720-45e397684e12}</Project> <Name>Tango.MachineStudio.Common</Name> </ProjectReference> + <ProjectReference Include="..\PPC\Tango.PPC.Common\Tango.PPC.Common.csproj"> + <Project>{0BE74EEE-22CB-4DBA-B896-793B9E1A3AC0}</Project> + <Name>Tango.PPC.Common</Name> + </ProjectReference> <ProjectReference Include="..\Tango.BL\Tango.BL.csproj"> <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> <Name>Tango.BL</Name> @@ -211,7 +215,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 |
