예제 #1
0
    public void IsEquals_NonTimeUnitObject_ThatCanBeConverted()
    {
        TimeUnit a = new TimeUnit("2h");
        string   s = "120m";

        Assert.IsTrue(a.Equals(s));
    }
예제 #2
0
    public void IsEquals_NonTimeUnitObject()
    {
        TimeUnit a = new TimeUnit("100m");
        Object   x = new object();

        Assert.IsFalse(a.Equals(x));
    }
예제 #3
0
    public void TestNotEqual()
    {
        TimeUnit t1 = new TimeUnit(45);
        TimeUnit t2 = new TimeUnit(44);

        Assert.False(t1.Equals(t2));
    }
예제 #4
0
    public void TestEquals()
    {
        TimeUnit t1 = new TimeUnit(45);
        TimeUnit t2 = new TimeUnit(45);

        Assert.True(t1.Equals(t2));
    }
예제 #5
0
    public void IsEquals(string a, string b, bool expectedResult)
    {
        TimeUnit timeUnit_A = new TimeUnit(a);
        TimeUnit timeUnit_B = new TimeUnit(b);

        bool actual = (timeUnit_A.Equals(timeUnit_B));

        Assert.AreEqual(expectedResult, actual, "A10:");
    }
        /// <summary>
        /// Returns true if OrgApacheSlingCommonsMetricsInternalLogReporterProperties instances are equal
        /// </summary>
        /// <param name="other">Instance of OrgApacheSlingCommonsMetricsInternalLogReporterProperties to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrgApacheSlingCommonsMetricsInternalLogReporterProperties other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Period == other.Period ||
                     Period != null &&
                     Period.Equals(other.Period)
                     ) &&
                 (
                     TimeUnit == other.TimeUnit ||
                     TimeUnit != null &&
                     TimeUnit.Equals(other.TimeUnit)
                 ) &&
                 (
                     Level == other.Level ||
                     Level != null &&
                     Level.Equals(other.Level)
                 ) &&
                 (
                     LoggerName == other.LoggerName ||
                     LoggerName != null &&
                     LoggerName.Equals(other.LoggerName)
                 ) &&
                 (
                     Prefix == other.Prefix ||
                     Prefix != null &&
                     Prefix.Equals(other.Prefix)
                 ) &&
                 (
                     Pattern == other.Pattern ||
                     Pattern != null &&
                     Pattern.Equals(other.Pattern)
                 ) &&
                 (
                     RegistryName == other.RegistryName ||
                     RegistryName != null &&
                     RegistryName.Equals(other.RegistryName)
                 ));
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is MeasurementUnit other &&
                   ((CustomUnit == null && other.CustomUnit == null) || (CustomUnit?.Equals(other.CustomUnit) == true)) &&
                   ((AreaUnit == null && other.AreaUnit == null) || (AreaUnit?.Equals(other.AreaUnit) == true)) &&
                   ((LengthUnit == null && other.LengthUnit == null) || (LengthUnit?.Equals(other.LengthUnit) == true)) &&
                   ((VolumeUnit == null && other.VolumeUnit == null) || (VolumeUnit?.Equals(other.VolumeUnit) == true)) &&
                   ((WeightUnit == null && other.WeightUnit == null) || (WeightUnit?.Equals(other.WeightUnit) == true)) &&
                   ((GenericUnit == null && other.GenericUnit == null) || (GenericUnit?.Equals(other.GenericUnit) == true)) &&
                   ((TimeUnit == null && other.TimeUnit == null) || (TimeUnit?.Equals(other.TimeUnit) == true)) &&
                   ((Type == null && other.Type == null) || (Type?.Equals(other.Type) == true)));
        }