-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCommandOutputBuilderTest.cs
More file actions
44 lines (38 loc) · 1.13 KB
/
CommandOutputBuilderTest.cs
File metadata and controls
44 lines (38 loc) · 1.13 KB
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
using AwesomeAssertions;
using Mbc.Pcs.Net.Command;
using System;
using System.Collections.Generic;
using TwinCAT.PlcOpen;
using Xunit;
namespace Mbc.Pcs.Net.Test.Command
{
public class CommandOutputBuilderTest
{
[Fact]
public void ConvertTimeToTimeSpan()
{
// Arrange
var builder = CommandOutputBuilder.FromDictionary(new Dictionary<string, object>
{
{ "time", new TIME(TimeSpan.FromMinutes(2)) },
});
// Act
var value = builder.GetOutputData<TimeSpan>("time");
// Assert
value.Should().Be(TimeSpan.FromMinutes(2));
}
[Fact]
public void ConvertDateToDateTime()
{
// Arrange
var builder = CommandOutputBuilder.FromDictionary(new Dictionary<string, object>
{
{ "dt", new DATE(new DateTime(2019, 02, 15, 12, 43, 00)) },
});
// Act
var value = builder.GetOutputData<DateTime>("dt");
// Assert
value.Should().Be(new DateTime(2019, 02, 15));
}
}
}