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);
            }
        }
    }
}
class="w"> bytes = File.ReadAllBytes(@"D:\Downloads\Twine TWN Spec (3).pdf"); var file = Convert.ToBase64String(bytes); msg.AddAttachment("Twine Spec.pdf", file, "application/pdf"); var response = client.SendEmailAsync(msg).GetAwaiter().GetResult(); Assert.IsTrue(response.StatusCode == System.Net.HttpStatusCode.Accepted); } [TestMethod] public void Send_Template_Email() { var client = new SendGridClient(KEY); SendGridMessage msg = new SendGridMessage(); msg.SetFrom("test@example.com"); msg.AddTo("roy.mail.net@gmail.com"); msg.Subject = "SnapMatch Color Result"; msg.SetTemplateId("d-619b8adc604d4f6fa486d7bbc9e3c2cc"); var dynamicTemplateData = new { Message = "This is my personal note...", R = 0, G = 255, B = 0, }; msg.SetTemplateData(dynamicTemplateData); DetectionColorFile file = new DetectionColorFile(); file.RawColor = new DetectionColor() { R = 10, G = 20, B = 30 }; file.ProcessedColor = new DetectionColor() { R = 11, G = 21, B = 31 }; var base64 = Convert.ToBase64String(file.ToBytes()); msg.AddAttachment("SnapMatch Color.tcc", base64, "application/octet-stream"); var result = client.SendEmailAsync(msg).GetAwaiter().GetResult(); Assert.IsTrue(result.StatusCode == HttpStatusCode.Accepted); } } }