forked from dotnetcore/WebApiClient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTagItemTest.cs
42 lines (35 loc) · 1012 Bytes
/
TagItemTest.cs
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
using System;
using Xunit;
using WebApiClient;
namespace WebApiClient.Test
{
public class TagItemTest
{
[Fact]
public void Test_Tag_Object()
{
var tag = new TagItem(new object());
Assert.True(tag.IsNullValue == false);
var tagNull = new TagItem(null);
Assert.True(tagNull.IsNullValue);
}
[Fact]
public void Test_Tag_Int()
{
var tag = new TagItem(30);
var value = tag.AsInt32();
Assert.True(value == 30);
}
[Fact]
public void Test_Tag_Nullable()
{
DateTime? datetime = null;
var tagNull = new TagItem(datetime);
DateTime dateTime2 = DateTime.Now;
var tagTime = new TagItem(dateTime2);
Assert.True(tagNull.IsNullValue);
Assert.True(tagTime.AsDateTime() == dateTime2);
Assert.True(tagTime.ToString() == dateTime2.ToString());
}
}
}