forked from ThatRendle/Simple.Data
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPropertySetterBuilderTest.cs
More file actions
39 lines (36 loc) · 1023 Bytes
/
PropertySetterBuilderTest.cs
File metadata and controls
39 lines (36 loc) · 1023 Bytes
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
namespace Simple.Data.UnitTest
{
using System;
using NUnit.Framework;
[TestFixture]
public class PropertySetterBuilderTest
{
[Test]
public void ConvertsInt32ToNullableEnum()
{
var actual = PropertySetterBuilder.SafeConvertNullable<TestInt32Enum>(1);
Assert.True(actual.HasValue);
Assert.AreEqual(TestInt32Enum.One, actual.Value);
}
[Test]
public void ConvertsByteToNullableEnum()
{
const byte b = 1;
var actual = PropertySetterBuilder.SafeConvertNullable<TestByteEnum>(b);
Assert.True(actual.HasValue);
Assert.AreEqual(TestByteEnum.One, actual.Value);
}
public enum TestInt32Enum
{
Zero = 0,
One = 1,
Two = 2
}
public enum TestByteEnum : byte
{
Zero = 0,
One = 1,
Two = 2
}
}
}