Skip to content

Commit

Permalink
Simplify test case for DateTimeOffset ambiguous time (dotnet/corefx#3…
Browse files Browse the repository at this point in the history
…9971)

Commit migrated from dotnet/corefx@015653e
  • Loading branch information
ts2do authored and tarekgh committed Aug 2, 2019
1 parent 2bbb062 commit 69a565e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/libraries/System.Runtime/tests/System/DateTimeOffsetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -699,17 +699,15 @@ public static void ToLocalTime_MaxValue()

public static IEnumerable<object[]> ToLocalTime_Ambiguous_TestData()
{
yield return new object[] { new DateTime(2019, 11, 3, 8, 0, 0), new TimeSpan(-7, 0, 0) };
yield return new object[] { new DateTime(2019, 11, 3, 9, 0, 0), new TimeSpan(-8, 0, 0) };
yield return new object[] { new DateTimeOffset(2019, 11, 3, 1, 0, 0, new TimeSpan(-7, 0, 0)) };
yield return new object[] { new DateTimeOffset(2019, 11, 3, 1, 0, 0, new TimeSpan(-8, 0, 0)) };
}

[ConditionalTheory(nameof(IsPacificTime))]
[MemberData(nameof(ToLocalTime_Ambiguous_TestData))]
public static void ToLocalTime_Ambiguous(DateTime utc, TimeSpan offset)
public static void ToLocalTime_Ambiguous(DateTimeOffset dateTimeOffset)
{
DateTimeOffset expectedLocalTime = new DateTimeOffset(utc + offset, offset);
DateTimeOffset actualLocalTime = new DateTimeOffset(utc, default).ToLocalTime();
Assert.Equal(expectedLocalTime, actualLocalTime);
Assert.True(dateTimeOffset.EqualsExact(dateTimeOffset.ToLocalTime()));
}

public static IEnumerable<object[]> Equals_TestData()
Expand Down

0 comments on commit 69a565e

Please sign in to comment.