blob: a574f7ea0381ddbdaa3d202cd952e01f474379a9 (
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
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
{
/// <summary>
/// Creates the DTO from observable and map DTO to observable test.
/// </summary>
[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);
}
}
}
}
|