コード例 #1
0
        public override bool Equals(object obj)
        {
            bool result = false;

            if (obj is ConsoleTelemetry)
            {
                ConsoleTelemetry other = (ConsoleTelemetry)obj;
                result = Id.Equals(other.Id) &&
                         Temperature.Equals(other.Temperature) &&
                         Humidity.Equals(other.Humidity) &&
                         Timestamp.Equals(other.Timestamp);
            }
            return(result);
        }
コード例 #2
0
ファイル: ForecastEntity.cs プロジェクト: Yuriy27/WeatherApp
 protected bool Equals(ForecastEntity other)
 {
     return(Id == other.Id &&
            string.Equals(City, other.City) &&
            Date.Equals(other.Date) &&
            Pressure.Equals(other.Pressure) &&
            Humidity.Equals(other.Humidity) &&
            TemperatureMorning.Equals(other.TemperatureMorning) &&
            TemperatureDay.Equals(other.TemperatureDay) &&
            TemperatureEvening.Equals(other.TemperatureEvening) &&
            TemperatureNight.Equals(other.TemperatureNight) &&
            WindSpeed.Equals(other.WindSpeed) &&
            string.Equals(Description, other.Description) &&
            string.Equals(Icon, other.Icon));
 }
コード例 #3
0
        /// <summary>
        /// Returns true if Forecast instances are equal
        /// </summary>
        /// <param name="other">Instance of Forecast to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Forecast other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Date == other.Date ||
                     Date != null &&
                     Date.Equals(other.Date)
                     ) &&
                 (
                     Pressure == other.Pressure ||
                     Pressure != null &&
                     Pressure.Equals(other.Pressure)
                 ) &&
                 (
                     Humidity == other.Humidity ||
                     Humidity != null &&
                     Humidity.Equals(other.Humidity)
                 ) &&
                 (
                     WindSpeed == other.WindSpeed ||
                     WindSpeed != null &&
                     WindSpeed.Equals(other.WindSpeed)
                 ) &&
                 (
                     Clouds == other.Clouds ||
                     Clouds != null &&
                     Clouds.Equals(other.Clouds)
                 ) &&
                 (
                     Temperature == other.Temperature ||
                     Temperature != null &&
                     Temperature.Equals(other.Temperature)
                 ) &&
                 (
                     Weather == other.Weather ||
                     Weather != null &&
                     Weather.Equals(other.Weather)
                 ));
        }
コード例 #4
0
 protected bool Equals(MainValues other)
 {
     return(Temp.Equals(other.Temp) && TempMin.Equals(other.TempMin) && TempMax.Equals(other.TempMax) && Pressure.Equals(other.Pressure) && SeaLevel.Equals(other.SeaLevel) && GroundLevel.Equals(other.GroundLevel) && Humidity.Equals(other.Humidity));
 }
コード例 #5
0
        public void EqualsReturnsFalseOnNull()
        {
            Humidity percent = Humidity.FromPercents(1);

            Assert.False(percent.Equals(null));
        }
コード例 #6
0
        public void EqualsReturnsFalseOnTypeMismatch()
        {
            Humidity percent = Humidity.FromPercents(1);

            Assert.False(percent.Equals(new object()));
        }