public override bool Equals(Value other) { if (other is DateTimeValue) { ZonedDateTime that = (( DateTimeValue )other)._value; bool res = _value.toLocalDateTime().Equals(that.toLocalDateTime()); if (res) { ZoneId thisZone = _value.Zone; ZoneId thatZone = that.Zone; bool thisIsOffset = thisZone is ZoneOffset; bool thatIsOffset = thatZone is ZoneOffset; if (thisIsOffset && thatIsOffset) { res = thisZone.Equals(thatZone); } else if (!thisIsOffset && !thatIsOffset) { res = string.ReferenceEquals(TimeZones.map(thisZone.Id), TimeZones.map(thatZone.Id)); } else { res = false; } } return(res); } return(false); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void weSupportAllJavaZoneIds() internal virtual void WeSupportAllJavaZoneIds() { ZoneId.AvailableZoneIds.forEach(s => { short num = TimeZones.map(s); assertThat("Our time zone table does not have a mapping for " + s, num, greaterThanOrEqualTo(( short )0)); string nameFromTable = TimeZones.Map(num); if (!s.Equals(nameFromTable)) { // The test is running on an older Java version and `s` has been removed since, thus it points to a different zone now. // That zone should point to itself, however. assertThat("Our time zone table has inconsistent mapping for " + nameFromTable, TimeZones.Map(TimeZones.Map(nameFromTable)), equalTo(nameFromTable)); } }); }