18 using NUnit.Framework;
20 namespace Deveel.Data.Sql.Objects {
22 [Category(
"SQL Objects")]
23 [Category(
"Date Time")]
26 [Category(
"Day To Second Interval")]
28 var value =
new SqlDateTime(2001, 01, 03, 10, 22, 03, 0);
32 Assert.DoesNotThrow(() => result = value.Add(ts));
33 Assert.IsFalse(result.IsNull);
34 Assert.AreEqual(2001, result.Year);
35 Assert.AreEqual(01, result.Month);
36 Assert.AreEqual(03, result.Day);
37 Assert.AreEqual(12, result.Hour);
38 Assert.AreEqual(25, result.Minute);
42 [Category(
"Day To Second Interval")]
44 var value =
new SqlDateTime(2001, 01, 03, 10, 22, 03, 0);
48 Assert.DoesNotThrow(() => result = value.Subtract(ts));
49 Assert.IsFalse(result.IsNull);
50 Assert.AreEqual(2001, result.Year);
51 Assert.AreEqual(01, result.Month);
52 Assert.AreEqual(03, result.Day);
53 Assert.AreEqual(8, result.Hour);
54 Assert.AreEqual(19, result.Minute);
58 [Category(
"Year To Month")]
60 var value =
new SqlDateTime(2001, 11, 03, 10, 22, 03, 0);
64 Assert.DoesNotThrow(() => result = value.Add(ms));
65 Assert.IsFalse(result.IsNull);
66 Assert.AreEqual(2003, result.Year);
67 Assert.AreEqual(02, result.Month);
68 Assert.AreEqual(10, result.Hour);
69 Assert.AreEqual(22, result.Minute);
70 Assert.AreEqual(03, result.Second);
71 Assert.AreEqual(0, result.Millisecond);
75 [Category(
"Year To Month")]
77 var value =
new SqlDateTime(2001, 11, 03, 10, 22, 03, 0);
81 Assert.DoesNotThrow(() => result = value.Subtract(ms));
82 Assert.IsFalse(result.IsNull);
83 Assert.AreEqual(2000, result.Year);
84 Assert.AreEqual(08, result.Month);
85 Assert.AreEqual(10, result.Hour);
86 Assert.AreEqual(22, result.Minute);
87 Assert.AreEqual(03, result.Second);
88 Assert.AreEqual(0, result.Millisecond);
92 [Category(
"Operators")]
93 [Category(
"Day To Second Interval")]
95 var value =
new SqlDateTime(2001, 01, 03, 10, 22, 03, 0);
99 Assert.DoesNotThrow(() => result = value + ts);
100 Assert.IsFalse(result.IsNull);
101 Assert.AreEqual(2001, result.Year);
102 Assert.AreEqual(01, result.Month);
103 Assert.AreEqual(03, result.Day);
104 Assert.AreEqual(12, result.Hour);
105 Assert.AreEqual(25, result.Minute);
109 [Category(
"Day To Second Interval")]
110 [Category(
"Operators")]
112 var value =
new SqlDateTime(2001, 01, 03, 10, 22, 03, 0);
116 Assert.DoesNotThrow(() => result = value - ts);
117 Assert.IsFalse(result.IsNull);
118 Assert.AreEqual(2001, result.Year);
119 Assert.AreEqual(01, result.Month);
120 Assert.AreEqual(03, result.Day);
121 Assert.AreEqual(8, result.Hour);
122 Assert.AreEqual(19, result.Minute);
126 [Category(
"Operators")]
128 var value1 =
new SqlDateTime(2030, 03, 01, 11, 05, 54, 0);
129 var value2 =
new SqlDateTime(2030, 03, 01, 11, 05, 54, 0);
131 Assert.IsTrue(value1 == value2);
135 [Category(
"Operators")]
137 var value1 =
new SqlDateTime(2030, 03, 01, 11, 05, 54, 0);
138 var value2 =
new SqlDateTime(2020, 05, 01, 11, 05, 54, 0);
140 Assert.IsTrue(value1 != value2);
144 [Category(
"Operators")]
146 var value1 =
new SqlDateTime(2030, 03, 01, 11, 05, 54, 0);
147 var value2 =
new SqlDateTime(2020, 05, 01, 11, 05, 54, 0);
149 Assert.IsTrue(value1 > value2);
void Operator_Add_TimeSpan()
void Operator_Subtract_TimeSpan()
void Subtract_MonthSpan()
void Subtract_TimeSpan_NoDays()
void Add_TimeSpan_NoDays()
A month span representation of time.