public void should_compare_with_null() { var date = new AwesomeDateTimeOffset(DateTime.UtcNow, TimeSpan.FromHours(8)); Assert.False(date.Equals(null)); Assert.False(date == null); Assert.True(date != null); }
public void should_compare_dates_2() { var time = new AwesomeDateTimeOffset( new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc), new TimeSpan(8, 0, 0)); var differentTime = new AwesomeDateTimeOffset( new DateTime(1999, 12, 30, 16, 0, 0, DateTimeKind.Utc), new TimeSpan(0, 0, 0)); Assert.False(time == differentTime); Assert.True(time != differentTime); Assert.False(time.Equals(differentTime)); }
public void should_modify_offset() { var time = new AwesomeDateTimeOffset( new DateTime(2000, 1, 1, 0, 0, 0, DateTimeKind.Utc), new TimeSpan(8, 0, 0)); var sameTime = new AwesomeDateTimeOffset( new DateTime(1999, 12, 31, 16, 0, 0, DateTimeKind.Utc), new TimeSpan(0, 0, 0)); sameTime.SetOffset(new TimeSpan(2, 0, 0)); Assert.True(time.Equals(sameTime)); Assert.True(time == sameTime); Assert.False(time != sameTime); Assert.Equal(time.GetHashCode(), sameTime.GetHashCode()); }
public void should_compare_with_other_type() { var date = new AwesomeDateTimeOffset(DateTime.UtcNow, TimeSpan.FromHours(8)); Assert.False(date.Equals("hello")); }