aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.UnitTesting/BL/HardwareConfiguration_TST.cs
blob: 20eadd6c9f07c1b56b8e65bbd9a1ad31d81272fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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);
            }
        }
    }
}
an class="w"> == &upload_hardware_configuration_response__descriptor); return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); } UploadHardwareConfigurationResponse * upload_hardware_configuration_response__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data) { return (UploadHardwareConfigurationResponse *) protobuf_c_message_unpack (&upload_hardware_configuration_response__descriptor, allocator, len, data); } void upload_hardware_configuration_response__free_unpacked (UploadHardwareConfigurationResponse *message, ProtobufCAllocator *allocator) { if(!message) return; assert(message->base.descriptor == &upload_hardware_configuration_response__descriptor); protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); } #define upload_hardware_configuration_response__field_descriptors NULL #define upload_hardware_configuration_response__field_indices_by_name NULL #define upload_hardware_configuration_response__number_ranges NULL const ProtobufCMessageDescriptor upload_hardware_configuration_response__descriptor = { PROTOBUF_C__MESSAGE_DESCRIPTOR_MAGIC, "UploadHardwareConfigurationResponse", "UploadHardwareConfigurationResponse", "UploadHardwareConfigurationResponse", "", sizeof(UploadHardwareConfigurationResponse), 0, upload_hardware_configuration_response__field_descriptors, upload_hardware_configuration_response__field_indices_by_name, 0, upload_hardware_configuration_response__number_ranges, (ProtobufCMessageInit) upload_hardware_configuration_response__init, NULL,NULL,NULL /* reserved[123] */ };