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.Builders; using Tango.BL.DTO; using System.Data.Entity; using DeepEqual.Syntax; namespace Tango.UnitTesting.BL { [TestClass] [TestCategory("BL - DTO")] public class DTO_TST { /// /// Creates the DTO from observable and map DTO to observable test. /// [TestMethod] public void Create_DTO_From_Observable_and_Map_DTO_To_Observable() { using (ObservablesContext db = ObservablesContext.CreateDefault()) { var config = new ConfigurationBuilder(db).SetFirst().WithIdsPacks().Build(); var configDTO = ConfigurationDTO.FromObservable(config); Assert.IsTrue(configDTO.Equals(config)); configDTO.MapToObservable(config); Assert.IsTrue(configDTO.Equals(config)); config = configDTO.ToObservable(); Assert.IsTrue(configDTO.Equals(config)); } } [TestMethod] public void DTOPropertyAttribute_Is_Working() { using (ObservablesContext db = ObservablesContext.CreateDefault()) { var hwBlower = db.HardwareBlowers.Include(x => x.HardwareBlowerType).First(); var dto = HardwareBlowerDTO.FromObservable(hwBlower); Assert.AreEqual(dto.HardwareBlowerTypeDescription, hwBlower.HardwareBlowerType.Description); } } } }