aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.UnitTesting
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-01-09 16:41:18 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-01-09 16:41:18 +0200
commita15947f35cc602d26cf3f51a5c76b6ada939ea12 (patch)
tree0dbd6c979324bb0714f5dd16df05f9290dac867d /Software/Visual_Studio/Tango.UnitTesting
parentaeebb8d47e1d78b50d9ae5afd9df6eaf9765ed87 (diff)
downloadTango-a15947f35cc602d26cf3f51a5c76b6ada939ea12.tar.gz
Tango-a15947f35cc602d26cf3f51a5c76b6ada939ea12.zip
Implemented job upload using JobDescriptionFile.
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting')
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/App.config20
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs43
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/ColorCatalogs_TST.cs33
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs216
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs72
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/DependencyInjection_TST.cs72
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/Helper.cs15
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/Integration_TST.cs65
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs28
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs123
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj13
-rw-r--r--Software/Visual_Studio/Tango.UnitTesting/packages.config1
12 files changed, 105 insertions, 596 deletions
diff --git a/Software/Visual_Studio/Tango.UnitTesting/App.config b/Software/Visual_Studio/Tango.UnitTesting/App.config
index da15f5d2c..cfe24c788 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/App.config
+++ b/Software/Visual_Studio/Tango.UnitTesting/App.config
@@ -74,6 +74,26 @@
<assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory.Platform" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" />
</dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.6.4.0" newVersion="5.6.4.0" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
+ </dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
+ </dependentAssembly>
</assemblyBinding>
</runtime>
<system.data>
diff --git a/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs
deleted file mode 100644
index fc80d5593..000000000
--- a/Software/Visual_Studio/Tango.UnitTesting/CodeGeneration_TST.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Tango.DAL.Remote.DB;
-using Tango.BL.Entities;
-using Tango.Settings;
-using System.Linq;
-using System.Collections.Generic;
-using Tango.DBObservablesGenerator.CLI;
-
-namespace Tango.UnitTesting
-{
- [TestClass]
- [TestCategory("Code Generation")]
- public class CodeGeneration_TST
- {
- [TestMethod]
- public void Generate_DAL_Observable_Entities()
- {
- String tempPath = Helper.GetTempFolderPath();
-
- ObservablesGenerator generator = new ObservablesGenerator();
- generator.GenerateCSharp(tempPath);
-
- Helper.ShowInExplorer(tempPath);
- }
-
- [TestMethod]
- public void Load_Observable_Machines()
- {
- //using (RemoteDB db = new RemoteDB(SettingsManager.Default.DataBase.SQLServerAddress, false))
- //{
- // List<Machine> machines = db.MACHINES.ToList().Select(x => new Machine(x)).ToList();
-
- // foreach (var machine in machines)
- // {
- // machine.SerialNumber = "1111";
- // machine.Organization.Address.AddressString = "HOW HOW HOW";
- // machine.Save();
- // }
- //}
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/ColorCatalogs_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/ColorCatalogs_TST.cs
deleted file mode 100644
index 927f40a45..000000000
--- a/Software/Visual_Studio/Tango.UnitTesting/ColorCatalogs_TST.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tango.BL;
-using Tango.BL.Catalogs;
-using Tango.Logging;
-
-namespace Tango.UnitTesting
-{
- [TestClass]
- [TestCategory("Color Catalogs")]
- public class ColorCatalogs_TST
- {
- [TestMethod]
- public void Load_And_Display_Twine_Catalog()
- {
- var console = Helper.InitializeLogging(true);
-
- LogManager.Default.Log("Loading Twine Catalog...");
-
- using (var db = ObservablesContext.CreateDefault())
- {
- var catalog = CatalogLoader.LoadCatalog(BL.Enumerations.ColorSpaces.Twine, db);
- LogManager.Default.Log(catalog.ToJsonString());
- }
-
- console.WaitForConsoleExit().Wait();
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs
deleted file mode 100644
index b2e32afce..000000000
--- a/Software/Visual_Studio/Tango.UnitTesting/ColorLib_TST.cs
+++ /dev/null
@@ -1,216 +0,0 @@
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System.Runtime.InteropServices;
-using Tango.PMR.ColorLab;
-using Tango.DAL.Remote.DB;
-using Tango.BL.Entities;
-using System.Linq;
-using Google.Protobuf;
-using Tango.PMR;
-using System.Collections.Generic;
-using Tango.BL;
-using System.IO;
-using System.Diagnostics;
-using Tango.Documents;
-using Tango.Core.IO;
-using Tango.MachineStudio.ColorLab.ViewModels;
-using Tango.BL.Calibration;
-
-namespace Tango.UnitTesting
-{
- [TestClass]
- [TestCategory("Color Lab")]
- public class ColorLib_TST
- {
- [DllImport("Tango.ColorLib.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "Convert")]
- public static extern int Convert(IntPtr data, int size, ref IntPtr output);
-
- [TestMethod]
- public void Convert_Color_To_Volumes()
- {
- ConversionInput conversionInput = new ConversionInput();
-
- conversionInput.ColorSpace = PMR.ColorLab.ColorSpace.Rgb;
- conversionInput.InputCoordinates = new InputCoordinates();
-
- conversionInput.SegmentLength = 10;
-
- conversionInput.InputCoordinates.Red = 50;
- conversionInput.InputCoordinates.Green = 100;
- conversionInput.InputCoordinates.Blue = 200;
-
- conversionInput.ThreadL = 92.1815;
- conversionInput.ThreadA = 2.2555;
- conversionInput.ThreadB = -10.9325;
-
- var cct = File.ReadAllBytes(@"D:\Development\Tango\Software\ColorData\CCT\test.cct");
-
- conversionInput.ForwardData = ByteString.CopyFrom(cct);
-
- conversionInput.InputCoordinates.InputLiquids.Add(new InputLiquid()
- {
- LiquidType = PMR.ColorLab.LiquidType.Cyan,
- CalibrationData = GenerateCalibrationData(PMR.ColorLab.LiquidType.Cyan),
- MaxNanoliterPerCentimeter = 200,
- });
-
- conversionInput.InputCoordinates.InputLiquids.Add(new InputLiquid()
- {
- LiquidType = PMR.ColorLab.LiquidType.Magenta,
- CalibrationData = GenerateCalibrationData(PMR.ColorLab.LiquidType.Magenta),
- MaxNanoliterPerCentimeter = 200,
- });
-
- conversionInput.InputCoordinates.InputLiquids.Add(new InputLiquid()
- {
- LiquidType = PMR.ColorLab.LiquidType.Yellow,
- CalibrationData = GenerateCalibrationData(PMR.ColorLab.LiquidType.Yellow),
- MaxNanoliterPerCentimeter = 200,
- });
-
- //using (ObservablesContext db = ObservablesContext.CreateDefault())
- //{
- // var cct = db.Ccts.FirstOrDefault();
-
- // Assert.IsNotNull(cct);
-
- // conversionInput.ForwardData = ByteString.CopyFrom(cct.ForwardData);
- // conversionInput.InverseData = ByteString.CopyFrom(cct.InverseData);
-
- // var machine = db.Machines.FirstOrDefault();
- // Assert.IsNotNull(machine);
-
- // var configuration = machine.Configuration;
- // var rml = db.Rmls.FirstOrDefault();
-
- // Assert.IsNotNull(rml);
-
- // List<LiquidTypesRml> factors = configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == rml.Guid).ToList();
-
- // foreach (var idsPack in configuration.IdsPacks.OrderBy(x => x.PackIndex))
- // {
- // InputLiquid inputLiquid = new InputLiquid();
- // inputLiquid.LiquidType = idsPack.LiquidType.ToColorLibLiquidType();
-
- // Assert.IsFalse(configuration.IdsPacks.IndexOf(idsPack) > factors.Count - 1);
-
- // inputLiquid.MaxNanoliterPerCentimeter = factors[configuration.IdsPacks.IndexOf(idsPack)].MaxNlPerCm;
-
- // inputLiquid.CalibrationData = GenerateCalibrationData(inputLiquid.LiquidType);
-
- // conversionInput.InputCoordinates.InputLiquids.Add(inputLiquid);
- // }
- //}
-
-
- NativePMR<ConversionInput, ConversionOutput> nativePMR = new NativePMR<ConversionInput, ConversionOutput>(Convert);
- ConversionOutput output = nativePMR.Invoke(conversionInput);
-
- Debug.WriteLine(output);
- }
-
- [TestMethod]
- public void Convert_Volumes_To_Color()
- {
- ConversionInput conversionInput = new ConversionInput();
-
- conversionInput.ColorSpace = PMR.ColorLab.ColorSpace.Volume;
-
- conversionInput.InputCoordinates = new InputCoordinates();
-
- conversionInput.SegmentLength = 100;
-
- conversionInput.ThreadL = 100;
- conversionInput.ThreadA = 0.00526049995830391;
- conversionInput.ThreadB = -0.010408184525267927;
-
- using (ObservablesContext db = ObservablesContext.CreateDefault())
- {
- var cct = db.Ccts.FirstOrDefault();
-
- Assert.IsNotNull(cct);
-
- conversionInput.ForwardData = ByteString.CopyFrom(cct.ForwardData);
- conversionInput.InverseData = ByteString.CopyFrom(cct.InverseData);
-
- var machine = db.Machines.FirstOrDefault();
- Assert.IsNotNull(machine);
-
- var configuration = machine.Configuration;
- var rml = db.Rmls.FirstOrDefault();
-
- Assert.IsNotNull(rml);
-
- List<LiquidTypesRml> factors = configuration.IdsPacks.OrderBy(x => x.PackIndex).Select(x => x.LiquidType).SelectMany(x => x.LiquidTypesRmls).Where(x => x.Rml.Guid == rml.Guid).ToList();
-
- foreach (var idsPack in configuration.IdsPacks.OrderBy(x => x.PackIndex))
- {
- InputLiquid inputLiquid = new InputLiquid();
- inputLiquid.LiquidType = idsPack.LiquidType.ToColorLibLiquidType();
-
- Assert.IsFalse(configuration.IdsPacks.IndexOf(idsPack) > factors.Count - 1);
-
- inputLiquid.MaxNanoliterPerCentimeter = factors[configuration.IdsPacks.IndexOf(idsPack)].MaxNlPerCm;
-
- inputLiquid.CalibrationData = GenerateCalibrationData(inputLiquid.LiquidType);
-
- inputLiquid.Volume = new Random().Next(0, 100);
-
- conversionInput.InputCoordinates.InputLiquids.Add(inputLiquid);
- }
- }
-
-
- NativePMR<ConversionInput, ConversionOutput> nativePMR = new NativePMR<ConversionInput, ConversionOutput>(Convert);
- ConversionOutput output = nativePMR.Invoke(conversionInput);
-
- Assert.IsTrue(output.SingleCoordinates.OutputLiquids.Count == conversionInput.InputCoordinates.InputLiquids.Count);
- }
-
- [TestMethod]
- public void Read_Write_Calibration_Data_Excel_File()
- {
- String temp_file = Helper.GetTempFolderPath() + "\\CalibrationData.xlsx";
-
- List<CalibrationPoint> w_calibration_points = new List<CalibrationPoint>();
-
- for (int i = 0; i < 10; i++)
- {
- w_calibration_points.Add(new CalibrationPoint()
- {
- X = i + 1,
- Y = (i + 1) * 10,
- });
- }
-
- CalibrationHelper.ExportCalibrationDataToExcel(w_calibration_points, temp_file);
- var r_calibration_points = CalibrationHelper.ImportCalibrationDataFromExcel(temp_file);
-
- Assert.AreEqual(w_calibration_points.Count, r_calibration_points.Count, "Read calibration points count does not match the written calibration points count.");
-
- for (int i = 0; i < w_calibration_points.Count; i++)
- {
- Assert.AreEqual(w_calibration_points[i].X + w_calibration_points[i].Y, r_calibration_points[i].X + r_calibration_points[i].Y, $"Calibration points at index {i} are not equal.");
- }
-
- Helper.ShowInExplorer(temp_file);
- }
-
- private static CalibrationData GenerateCalibrationData(PMR.ColorLab.LiquidType liquidType)
- {
- CalibrationData data = new CalibrationData();
- data.LiquidType = liquidType;
-
- for (int i = 0; i < 100; i++)
- {
- data.CalibrationPoints.Add(new CalibrationPoint()
- {
- X = i,
- Y = i,
- });
- }
-
- return data;
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs
deleted file mode 100644
index 994ef4172..000000000
--- a/Software/Visual_Studio/Tango.UnitTesting/DAL_TST.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Tango.DAL;
-using System.Linq;
-using Tango.Settings;
-using Tango.Core;
-using Tango.BL;
-
-namespace Tango.UnitTesting
-{
- [TestClass]
- [TestCategory("DAL")]
- public class DAL_TST
- {
- [TestMethod]
- public void Validate_Server_SQLServer_Connection()
- {
- String guid = Guid.NewGuid().ToString();
-
- 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";
-
-
- using (var db = new DAL.Remote.DB.RemoteDB(s))
- {
- var events = db.EVENT_TYPES.ToList();
- var motors = db.HARDWARE_MOTOR_TYPES.ToList();
- var monitors = db.TECH_MONITORS.ToList();
- }
- }
-
- [TestMethod]
- public void Validate_Local_SQLite_Connection()
- {
- String guid = Guid.NewGuid().ToString();
-
- using (var db = new DAL.Local.DB.LocalDB(Helper.GetSQLiteFilePath()))
- {
- var action = new DAL.Local.DB.ACTION_TYPES();
- action.CODE = 1;
- action.NAME = "Action 1";
- action.DESCRIPTION = "Description 1";
- action.GUID = guid;
-
- db.ACTION_TYPES.Add(action);
- db.SaveChanges();
- }
-
- using (var db = new DAL.Local.DB.LocalDB(Helper.GetSQLiteFilePath()))
- {
- var actions = db.ACTION_TYPES.ToList();
- var action = db.ACTION_TYPES.Single(x => x.GUID == guid);
- db.ACTION_TYPES.Remove(action);
- db.SaveChanges();
- }
- }
-
- [TestMethod]
- public void Validate_SQLite_Connection_Using_Observables()
- {
- using (ObservablesContext db = ObservablesContext.CreateDefault(@"D:\Development\Tango\Software\DB\Tango.db", DataSourceType.SQLite))
- {
- var actions = db.EventTypes.ToList();
- }
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/DependencyInjection_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/DependencyInjection_TST.cs
deleted file mode 100644
index 43e892351..000000000
--- a/Software/Visual_Studio/Tango.UnitTesting/DependencyInjection_TST.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tango.Core.DI;
-
-namespace Tango.UnitTesting
-{
- [TestClass]
- [TestCategory("Dependency Injection")]
- public class DependencyInjection_TST
- {
- [TestMethod]
- public void Test_Tango_Dependency_Injection()
- {
- TangoIOC.Default.Register<IDataProvider, DataProvider>();
- TangoIOC.Default.Register<IService, Service>();
- TangoIOC.Default.Register<ViewModel>();
-
- var vm = TangoIOC.Default.GetInstance<ViewModel>();
-
- Assert.IsNotNull(vm);
- Assert.IsNotNull(vm.Service);
- Assert.IsNotNull(vm.DataProvider);
- Assert.IsNotNull(vm.Service.DataProvider);
- Assert.IsNotNull(vm.GetDataProvider());
- }
-
- public class ViewModel
- {
- [TangoInject]
- private IDataProvider _dataProvider;
-
- public IDataProvider GetDataProvider()
- {
- return _dataProvider;
- }
-
- public IService Service { get; set; }
- public IDataProvider DataProvider { get; set; }
-
- public ViewModel(IService service, IDataProvider dataProvider)
- {
- DataProvider = dataProvider;
- Service = service;
- }
- }
-
- public interface IDataProvider
- {
-
- }
-
- public class DataProvider : IDataProvider
- {
-
- }
-
- public interface IService
- {
- IDataProvider DataProvider { get; set; }
- }
-
- public class Service : IService
- {
- [TangoInject]
- public IDataProvider DataProvider { get; set; }
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/Helper.cs b/Software/Visual_Studio/Tango.UnitTesting/Helper.cs
index ae7636c7b..6a4f860b9 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/Helper.cs
+++ b/Software/Visual_Studio/Tango.UnitTesting/Helper.cs
@@ -7,6 +7,8 @@ using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Tango.Logging;
+using DeepEqual;
+using DeepEqual.Syntax;
namespace Tango.UnitTesting
{
@@ -66,7 +68,7 @@ namespace Tango.UnitTesting
/// </summary>
public static ConsoleLogger InitializeLogging(bool useConsole = false, [CallerMemberName] string testName = null)
{
- LogManager.Default.RegisterLogger(new FileLogger(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "logs", "Unit Testing"),"Unit_Testing"));
+ LogManager.Default.RegisterLogger(new FileLogger(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "logs", "Unit Testing"), "Unit_Testing"));
if (useConsole)
{
var consoleLogger = new ConsoleLogger(testName);
@@ -125,5 +127,16 @@ namespace Tango.UnitTesting
{
Process.Start("explorer.exe", string.Format("/select,\"{0}\"", path));
}
+
+ /// <summary>
+ /// Returns true if the two objects are equal by using deep equal.
+ /// </summary>
+ /// <param name="obj1">First object.</param>
+ /// <param name="obj2">Second object.</param>
+ /// <returns></returns>
+ public static bool IsDeepEqual(Object obj1, Object obj2)
+ {
+ return obj1.IsDeepEqual(obj2);
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/Integration_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Integration_TST.cs
new file mode 100644
index 000000000..cbfc521bd
--- /dev/null
+++ b/Software/Visual_Studio/Tango.UnitTesting/Integration_TST.cs
@@ -0,0 +1,65 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Integration.Operation;
+using Tango.PMR.Printing;
+
+
+namespace Tango.UnitTesting
+{
+ [TestClass]
+ [TestCategory("Integration")]
+ public class Integration_TST
+ {
+ [TestMethod]
+ public void _Write_Read_Validate_JobDescriptionFile()
+ {
+ Random rnd = new Random();
+
+ List<JobSegment> segments = new List<JobSegment>();
+
+ for (int i = 0; i < 10; i++)
+ {
+ JobSegment seg = new JobSegment();
+ seg.Length = i;
+ seg.Name = "Segment " + rnd.Next();
+
+ for (int j = 0; j < 10; j++)
+ {
+ JobBrushStop stop = new JobBrushStop();
+ stop.Index = j;
+ stop.OffsetMeters = j;
+ stop.OffsetPercent = j;
+
+ for (int k = 0; k < 6; k++)
+ {
+ stop.Dispensers.Add(new JobDispenser()
+ {
+ DispenserLiquidType = DispenserLiquidType.Cyan,
+ Index = k,
+ NanolitterPerSecond = k,
+ });
+ }
+
+ seg.BrushStops.Add(stop);
+ }
+
+
+
+ segments.Add(seg);
+ }
+
+ JobDescriptionFile jobDescriptionFile = new JobDescriptionFile(segments);
+ MemoryStream ms = jobDescriptionFile.ToStream();
+ ms.Position = 0;
+ var read_segments = JobDescriptionFile.ReadJobDescriptionFile(ms);
+ ms.Dispose();
+
+ Assert.IsTrue(Helper.IsDeepEqual(segments, read_segments));
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs
deleted file mode 100644
index 0edab542a..000000000
--- a/Software/Visual_Studio/Tango.UnitTesting/MachineService_TST.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using System.Collections.Generic;
-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
-{
- [TestClass]
- [TestCategory("Machine Service")]
- public class MachineService_TST
- {
- [TestMethod]
- public void Check_For_Updates()
- {
- 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",
- }).Result;
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs
deleted file mode 100644
index 960cacf44..000000000
--- a/Software/Visual_Studio/Tango.UnitTesting/Synchronization_TST.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using remote = Tango.DAL.Remote.DB;
-using local = Tango.DAL.Local.DB;
-using Tango.Synchronization.Remote;
-using Tango.Settings;
-using Tango.Core;
-
-namespace Tango.UnitTesting
-{
- [TestClass]
- [TestCategory("Synchronization")]
- public class Synchronization_TST
- {
- [TestMethod]
- public void Compare_Remote_And_Local()
- {
- var console = Helper.InitializeLogging(true);
-
- using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource))
- {
- using (var localDB = new local.LocalDB(Helper.GetSQLiteFilePath()))
- {
- RemoteDBComparer comparer = new RemoteDBComparer(remoteDB, localDB, "1111");
- var diffs = comparer.Compare();
- }
- }
-
- console.WaitForConsoleExit().Wait();
- }
-
- [TestMethod]
- public void Synchronize_Remote_And_Local()
- {
- var console = Helper.InitializeLogging(true);
- RemoteDBSynchronizer.Synchronize(Helper.GetSQLiteFilePath(), "1111", true);
-
- console.WaitForConsoleExit().Wait();
- }
-
- [TestMethod]
- public void Generate_Demo_Remote_Machine()
- {
- using (var remoteDB = new remote.RemoteDB(SettingsManager.Default.GetOrCreate<CoreSettings>().DataSource))
- {
- var organization = new remote.ORGANIZATION()
- {
- ADDRESS = new remote.ADDRESS()
- {
- LAST_UPDATED = DateTime.UtcNow,
- GUID = Guid.NewGuid().ToString(),
- ADDRESS_STRING = "Demo Address",
- CITY = "Gan Yavne",
- COUNTRY = "Israel",
- COUNTRY_CODE = "IL",
- LOCALITY = "Local",
- POSTAL_CODE = "70800",
- STATE = "Hadarom",
- },
- CONTACT = new remote.CONTACT()
- {
- GUID = Guid.NewGuid().ToString(),
- LAST_UPDATED = DateTime.UtcNow,
- EMAIL = "roy.mail.net@gmail.com",
- FAX = "1234",
- FIRST_NAME = "Roy",
- FULL_NAME = "Roy Ben Shabat",
- LAST_NAME = "Ben Shabat",
- PHONE_NUMBER = "1234"
- },
- NAME = "Twine Demo",
- GUID = Guid.NewGuid().ToString(),
- LAST_UPDATED = DateTime.UtcNow,
- };
-
- var configuration = new remote.CONFIGURATION()
- {
- GUID = Guid.NewGuid().ToString(),
- LAST_UPDATED = DateTime.UtcNow,
- 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 },
- 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 },
- };
-
- var machine_version = new remote.MACHINE_VERSIONS()
- {
- GUID = Guid.NewGuid().ToString(),
- LAST_UPDATED = DateTime.UtcNow,
- VERSION = 1.0,
- };
-
- var machine = new remote.MACHINE()
- {
- GUID = Guid.NewGuid().ToString(),
- LAST_UPDATED = DateTime.UtcNow,
- ORGANIZATION = organization,
- PRODUCTION_DATE = DateTime.UtcNow,
- SERIAL_NUMBER = "1234",
- MACHINE_VERSIONS = machine_version,
- };
-
- //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.SaveChanges();
- }
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj
index 6c547102c..f1f2910c1 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj
+++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj
@@ -44,6 +44,9 @@
<Reference Include="Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\packages\Castle.Core.3.3.0\lib\net45\Castle.Core.dll</HintPath>
</Reference>
+ <Reference Include="DeepEqual, Version=1.6.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\DeepEqual.1.6.0.0\lib\net40\DeepEqual.dll</HintPath>
+ </Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll</HintPath>
</Reference>
@@ -91,10 +94,8 @@
<Compile Include="..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
- <Compile Include="ColorCatalogs_TST.cs" />
- <Compile Include="DependencyInjection_TST.cs" />
+ <Compile Include="Integration_TST.cs" />
<Compile Include="Logging_TST.cs" />
- <Compile Include="MachineService_TST.cs" />
<Compile Include="MachineStudio_TST.cs" />
<Compile Include="RemoteRunner_TST.cs" />
<Compile Include="SQLExaminer_TST.cs" />
@@ -106,10 +107,6 @@
<Compile Include="Helper.cs" />
<Compile Include="Protobuf_TST.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="DAL_TST.cs" />
- <Compile Include="Synchronization_TST.cs" />
- <Compile Include="CodeGeneration_TST.cs" />
- <Compile Include="ColorLib_TST.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
@@ -215,7 +212,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_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/Tango.UnitTesting/packages.config b/Software/Visual_Studio/Tango.UnitTesting/packages.config
index 326273243..4d34c7e52 100644
--- a/Software/Visual_Studio/Tango.UnitTesting/packages.config
+++ b/Software/Visual_Studio/Tango.UnitTesting/packages.config
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="3.3.0" targetFramework="net46" />
+ <package id="DeepEqual" version="1.6.0.0" targetFramework="net461" />
<package id="EntityFramework" version="6.0.0" targetFramework="net46" />
<package id="Google.Protobuf" version="3.4.1" targetFramework="net46" />
<package id="MSTest.TestAdapter" version="1.1.11" targetFramework="net45" />