From 1c74b1f3e6fd3f64936df890de14e162303ee1fb Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 16 Sep 2019 12:01:39 +0300 Subject: Implemented hardware configuration!!! --- .../BL/HardwareConfiguration_TST.cs | 38 ++++++++++++++++++++++ .../Tango.UnitTesting/Pulse/Pulse_TST.cs | 2 +- .../Tango.UnitTesting/Tango.UnitTesting.csproj | 3 +- 3 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 Software/Visual_Studio/Tango.UnitTesting/BL/HardwareConfiguration_TST.cs (limited to 'Software/Visual_Studio/Tango.UnitTesting') diff --git a/Software/Visual_Studio/Tango.UnitTesting/BL/HardwareConfiguration_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/BL/HardwareConfiguration_TST.cs new file mode 100644 index 000000000..20eadd6c9 --- /dev/null +++ b/Software/Visual_Studio/Tango.UnitTesting/BL/HardwareConfiguration_TST.cs @@ -0,0 +1,38 @@ +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.ValueObjects; + +namespace Tango.UnitTesting.BL +{ + [TestClass] + [TestCategory("BL - Hardware Configuration")] + public class HardwareConfiguration_TST + { + [TestMethod] + public void Merge_HardwareConfiguration_With_HardwareVersion() + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var hw = new Tango.BL.Builders.HardwareVersionBuilder(db).SetFirst().WithHardwareComponents().Build(); + + HardwareConfiguration config = new HardwareConfiguration(); + + config.Parameters.Add(new HardwareConfiguration.HardwareConfigurationParameter() + { + ComponentName = Tango.BL.Enumerations.HardwareMotorTypes.MOTO_DISPENSER_1.ToString(), + ParameterName = "MinFrequency", + Value = (int)100, + }); + + var cloned = config.Merge(hw); + + Assert.IsTrue(cloned.HardwareMotors.SingleOrDefault(x => x.HardwareMotorType.Name == Tango.BL.Enumerations.HardwareMotorTypes.MOTO_DISPENSER_1.ToString()).MinFrequency == 100); + } + } + } +} diff --git a/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs index 19afb93d4..b96ea50d1 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/Pulse/Pulse_TST.cs @@ -73,7 +73,7 @@ namespace Tango.UnitTesting.Pulse [TestMethod] public void Read_Pulse_Sample_File() { - String sampleFile = Path.Combine(Helper.GetResourcePath(), "Pulse", "Sankelloff_Rol.twn"); + String sampleFile = Path.Combine(Helper.GetResourcePath(), "Pulse", "Technical_Test_15.9.19.twn"); TwnFile twnFile = TwnFile.FromFile(sampleFile); var imgFile = TemporaryManager.Default.CreateFile(".png"); diff --git a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj index 28144e010..05daac6c7 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj +++ b/Software/Visual_Studio/Tango.UnitTesting/Tango.UnitTesting.csproj @@ -137,6 +137,7 @@ + @@ -308,7 +309,7 @@ - + \ No newline at end of file -- cgit v1.3.1