Skip to content

Commit ca1165e

Browse files
committed
Unit test fix
1 parent 1454e43 commit ca1165e

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/Tests/SmartStore.Services.Tests/Helpers/DateTimeHelperTests.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,19 +124,26 @@ public void Can_get_customer_timeZone_with_customTimeZones_disabled()
124124
[Test]
125125
public void Can_convert_dateTime_to_userTime()
126126
{
127-
var sourceDateTime = TimeZoneInfo.FindSystemTimeZoneById("E. Europe Standard Time"); //(GMT+02:00) Minsk;
127+
var sourceDateTime = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time"); // (GMT+01:00) Berlin;
128128
sourceDateTime.ShouldNotBeNull();
129129

130-
var destinationDateTime = TimeZoneInfo.FindSystemTimeZoneById("North Asia Standard Time"); //(GMT+07:00) Krasnoyarsk;
130+
var destinationDateTime = TimeZoneInfo.FindSystemTimeZoneById("GTB Standard Time"); // (GMT+02:00) Istanbul;
131131
destinationDateTime.ShouldNotBeNull();
132132

133-
//summer time
134-
_dateTimeHelper.ConvertToUserTime(new DateTime(2010, 06, 01, 0, 0, 0), sourceDateTime, destinationDateTime)
135-
.ShouldEqual(new DateTime(2010, 06, 01, 5, 0, 0));
133+
// Berlin > Istanbul
134+
_dateTimeHelper
135+
.ConvertToUserTime(new DateTime(2015, 06, 1, 0, 0, 0), sourceDateTime, destinationDateTime)
136+
.ShouldEqual(new DateTime(2015, 06, 1, 1, 0, 0));
136137

137-
//winter time
138-
_dateTimeHelper.ConvertToUserTime(new DateTime(2010, 01, 01, 0, 0, 0), sourceDateTime, destinationDateTime)
139-
.ShouldEqual(new DateTime(2010, 01, 01, 5, 0, 0));
138+
// UTC > Istanbul (summer)
139+
_dateTimeHelper
140+
.ConvertToUserTime(new DateTime(2015, 06, 1, 0, 0, 0), TimeZoneInfo.Utc, destinationDateTime)
141+
.ShouldEqual(new DateTime(2015, 06, 1, 3, 0, 0));
142+
143+
// UTC > Istanbul (winter)
144+
_dateTimeHelper
145+
.ConvertToUserTime(new DateTime(2015, 01, 01, 0, 0, 0), TimeZoneInfo.Utc, destinationDateTime)
146+
.ShouldEqual(new DateTime(2015, 01, 1, 2, 0, 0));
140147
}
141148

142149
[Test]

0 commit comments

Comments
 (0)