public void EqualityHasValueSemantics() { var time1 = new Timestamp(100000000); var time2 = new Timestamp(200000000); var time3 = new Timestamp(100000000); Assert.IsTrue(time1.Equals(time1)); Assert.IsTrue(time1 == time1); Assert.IsTrue(time1.Equals(time3)); Assert.IsTrue(time1 == time3); Assert.IsFalse(time1.Equals(time2)); Assert.IsTrue(time1 != time2); }
/// <summary> /// Returns true if DiskSpaceMonitorDescriptorDiskSpace instances are equal /// </summary> /// <param name="other">Instance of DiskSpaceMonitorDescriptorDiskSpace to be compared</param> /// <returns>Boolean</returns> public bool Equals(DiskSpaceMonitorDescriptorDiskSpace other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Class == other.Class || Class != null && Class.Equals(other.Class) ) && ( Timestamp == other.Timestamp || Timestamp != null && Timestamp.Equals(other.Timestamp) ) && ( Path == other.Path || Path != null && Path.Equals(other.Path) ) && ( Size == other.Size || Size != null && Size.Equals(other.Size) )); }
/// <summary> /// Checks whether the current log message equals the specified one. /// </summary> /// <param name="other">Log message to compare with.</param> /// <returns> /// true, if the current log message equals the specified one; /// otherwise false. /// </returns> public virtual bool Equals(ILogMessage other) { switch (other) { case null: return(false); case LogMessage otherLogMessage: return(Equals(otherLogMessage)); default: lock (Sync) { return(Timestamp.Equals(other.Timestamp) && HighPrecisionTimestamp == other.HighPrecisionTimestamp && LogWriterName == other.LogWriterName && LogLevelName == other.LogLevelName && ApplicationName == other.ApplicationName && ProcessName == other.ProcessName && ProcessId == other.ProcessId && Text == other.Text && Equals(Tags, other.Tags)); } } }
/// <summary> /// Returns true if ViltConnectorLaunchSessionSuccessResponse instances are equal /// </summary> /// <param name="other">Instance of ViltConnectorLaunchSessionSuccessResponse to be compared</param> /// <returns>Boolean</returns> public bool Equals(ViltConnectorLaunchSessionSuccessResponse other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Status == other.Status || Status != null && Status.Equals(other.Status) ) && ( CorrelationId == other.CorrelationId || CorrelationId != null && CorrelationId.Equals(other.CorrelationId) ) && ( Timestamp == other.Timestamp || Timestamp != null && Timestamp.Equals(other.Timestamp) ) && ( Data == other.Data || Data != null && Data.Equals(other.Data) )); }
/// <summary> /// Returns true if ViltConnectorErrorResponse instances are equal /// </summary> /// <param name="other">Instance of ViltConnectorErrorResponse to be compared</param> /// <returns>Boolean</returns> public bool Equals(ViltConnectorErrorResponse other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Status == other.Status || Status != null && Status.Equals(other.Status) ) && ( CorrelationId == other.CorrelationId || CorrelationId != null && CorrelationId.Equals(other.CorrelationId) ) && ( Timestamp == other.Timestamp || Timestamp != null && Timestamp.Equals(other.Timestamp) ) && ( Error == other.Error || Error != null && Error.Equals(other.Error) )); }
/// <summary> /// Returns true if CoronaStatus instances are equal /// </summary> /// <param name="other">Instance of CoronaStatus to be compared</param> /// <returns>Boolean</returns> public bool Equals(CoronaStatus other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Timestamp == other.Timestamp || Timestamp != null && Timestamp.Equals(other.Timestamp) ) && ( Status == other.Status || Status != null && Status.Equals(other.Status) )); }
/// <summary> /// Returns true if ResponseTimeMonitorData instances are equal /// </summary> /// <param name="other">Instance of ResponseTimeMonitorData to be compared</param> /// <returns>Boolean</returns> public bool Equals(ResponseTimeMonitorData other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Class == other.Class || Class != null && Class.Equals(other.Class) ) && ( Timestamp == other.Timestamp || Timestamp != null && Timestamp.Equals(other.Timestamp) ) && ( Average == other.Average || Average != null && Average.Equals(other.Average) )); }
public void testTest() { var a = new Timestamp(5); Timestamp b = new Timestamp(5); Assert.True(a.Equals(b)); }
/// <summary> /// Returns true if DeviceData instances are equal /// </summary> /// <param name="other">Instance of DeviceData to be compared</param> /// <returns>Boolean</returns> public bool Equals(DeviceData other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( DeviceId == other.DeviceId || DeviceId != null && DeviceId.Equals(other.DeviceId) ) && ( Timestamp == other.Timestamp || Timestamp != null && Timestamp.Equals(other.Timestamp) ) && ( Value == other.Value || Value != null && Value.Equals(other.Value) )); }
public void Two_timestamps_with_the_same_value_should_be_equal() { var first = new Timestamp("00:00:00,001"); var second = new Timestamp("00:00:00,001"); Assert.That(first.Equals(second), "first.Equals(second)"); Assert.That(first == second, "first == second"); }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (!base.Equals(obj)) { return(false); } if (!(obj is EntryPosition)) { return(false); } var other = (EntryPosition)obj; if (JournalName == null) { if (other.JournalName != null) { return(false); } } else if (!JournalName.Equals(other.JournalName)) { return(false); } if (Position == null) { if (other.Position != null) { return(false); } } else if (!Position.Equals(other.Position)) { return(false); } // 手写equals,自动生成时需注意 if (Timestamp == null) { if (other.Timestamp != null) { return(false); } } else if (!Timestamp.Equals(other.Timestamp)) { return(false); } return(true); }
public void TimestampEqualityTest() { //Arrange double d1 = 10; double d2 = 15; double d3 = 5; String s1 = "12:34:56.7"; String s2 = "30:30:30.3"; String s3 = "00:00:05.0"; Timestamp td; Timestamp ts; Timestamp t3; Timestamp t4; Object o5; //Act td = new Timestamp(d1); ts = new Timestamp(s1); t3 = new Timestamp(d3); t4 = new Timestamp(s3); o5 = new Timestamp(d3); //Assert Assert.IsTrue(td.Equals(d1)); Assert.IsFalse(td.Equals(d2)); Assert.IsTrue(ts.Equals(s1)); Assert.IsFalse(ts.Equals(s2)); Assert.IsTrue(t3.Equals(d3)); Assert.IsTrue(t3.Equals(s3)); //Test it against itself Assert.IsTrue(t3.Equals(t3)); //Test it agaist different Timestamp with same value Assert.IsTrue(t3.Equals(t4)); //Test it agaist object Assert.IsTrue(t3.Equals(o5)); //Assert double and string equality Assert.IsTrue(d3.Equals(t3)); Assert.IsTrue(s3.Equals(t3)); }
public void Timestamp_should_not_equal_with_null() { var sut = new Timestamp("00:00:00,001"); Assert.That(sut.Equals(null), Is.False); // ReSharper disable ConditionIsAlwaysTrueOrFalse Assert.That(sut == null, Is.False); // ReSharper restore ConditionIsAlwaysTrueOrFalse }
public override bool Equals(object obj) { if (ReferenceEquals(this, obj)) { return(true); } return((obj is UsedCode other) && Code.Equals(other.Code) && Timestamp.Equals(other.Timestamp) && User.Equals(other.User)); }
public bool Equals(PriceDataPoint other) { if ((object)other == null) { return(false); } return(Timestamp.Equals(other.Timestamp)); }
public void The_timestamp_should_be_equal_with_itself() { var sut = new Timestamp("00:00:00,001"); Assert.That(sut.Equals(sut), "sut.Equals(sut)"); // ReSharper disable EqualExpressionComparison #pragma warning disable CS1718 // Comparison made to same variable Assert.That(sut == sut, "sut == sut"); #pragma warning restore CS1718 // Comparison made to same variable // ReSharper restore EqualExpressionComparison }
/// <summary> /// Compares two id tag infos for equality. /// </summary> /// <param name="MeterValue">An id tag info to compare with.</param> /// <returns>True if both match; False otherwise.</returns> public Boolean Equals(MeterValue MeterValue) { if (MeterValue is null) { return(false); } return(Timestamp.Equals(MeterValue.Timestamp) && //FixMe! SampledValues.Count().Equals(MeterValue.SampledValues.Count())); }
/// <summary> /// Checks equality with another message. /// </summary> /// <param name="other">other Message object.</param> /// <returns>true / false..</returns> protected bool Equals(Message other) { return(string.Equals(Id, other.Id) && string.Equals(ClientId, other.ClientId) && string.Equals(ConnectionId, other.ConnectionId) && string.Equals(Name, other.Name) && Timestamp.Equals(other.Timestamp) && Equals(Data, other.Data) && string.Equals(Encoding, other.Encoding) && Equals(Extras, other.Extras)); }
public void Equality_must_be_commutative() { var first = new Timestamp("00:00:00,001"); var second = new Timestamp("00:00:00,001"); Assert.That(first.Equals(second)); Assert.That(second.Equals(first)); Assert.That(first == second); Assert.That(second == first); }
/// <summary> /// Compares two id tag infos for equality. /// </summary> /// <param name="MeterValue">An id tag info to compare with.</param> /// <returns>True if both match; False otherwise.</returns> public Boolean Equals(MeterValue MeterValue) { if ((Object)MeterValue == null) { return(false); } return(Timestamp.Equals(MeterValue.Timestamp) && SampledValues.Count().Equals(MeterValue.SampledValues.Count())); }
public bool Equals(SnapshotUpdate other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(string.Equals(CurrencyPair, other.CurrencyPair) && Timestamp.Equals(other.Timestamp)); }
public bool Equals(RecentSearch other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Timestamp.Equals(other.Timestamp) && string.Equals(Text, other.Text)); }
/// <inheritdoc /> public bool Equals(TimestampBound other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Mode == other.Mode && Staleness.Equals(other.Staleness) && Timestamp.Equals(other.Timestamp)); }
/// <inheritdoc /> public bool Equals(JournalEvent other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Timestamp.Equals(other.Timestamp) && string.Equals(Event, other.Event, StringComparison.OrdinalIgnoreCase)); }
public bool Equals(RecentFile other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Timestamp.Equals(other.Timestamp) && string.Equals(Name, other.Name)); }
public bool Equals(Emit <T> other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(ChannelId.Equals(other.ChannelId) && Timestamp.Equals(other.Timestamp) && EqualityComparer <T> .Default.Equals(Payload, other.Payload)); }
public void Equality() { Timestamp t1 = new Timestamp(1, 2); // Equal Timestamp t2 = new Timestamp(1, 2); // Difference in seconds Timestamp t3 = new Timestamp(2, 2); // Difference in nanoseconds Timestamp t4 = new Timestamp(2, 3); // Equals(Timestamp) Assert.True(t1.Equals(t2)); Assert.False(t1.Equals(t3)); Assert.False(t1.Equals(t4)); // Equals(object) Assert.True(t1.Equals((object)t2)); Assert.False(t1.Equals((object)t3)); Assert.False(t1.Equals((object)t4)); Assert.True(t1 == t2); Assert.False(t1 == t3); Assert.False(t1 == t4); Assert.False(t1 != t2); Assert.True(t1 != t3); Assert.Equal(t1.GetHashCode(), t2.GetHashCode()); Assert.NotEqual(t1.GetHashCode(), t3.GetHashCode()); Assert.NotEqual(t1.GetHashCode(), t4.GetHashCode()); }
public override bool Equals(object obj) { var match = obj as Match; if (match == null) { return(false); } return(Server.Equals(match.Server) && Timestamp.Equals(match.Timestamp) && Results.Equals(match.Results)); }
protected bool Equals(HistoricalBar other) { return(Timestamp.Equals(other.Timestamp) && High.Equals(other.High) && Low.Equals(other.Low) && Open.Equals(other.Open) && Close.Equals(other.Close) && TotalVolume == other.TotalVolume && PeriodVolume == other.PeriodVolume && TotalTrade == other.TotalTrade && PeriodTrade == other.PeriodTrade && VWAP.Equals(other.VWAP)); }
public void Equality() { var ts1 = new Timestamp(new DateTime(2010, 3, 4), TimestampType.CreateTime); var ts2 = new Timestamp(new DateTime(2010, 3, 4), TimestampType.CreateTime); var ts3 = new Timestamp(new DateTime(2011, 3, 4), TimestampType.CreateTime); var ts4 = new Timestamp(new DateTime(2010, 3, 4), TimestampType.LogAppendTime); Assert.Equal(ts1, ts2); Assert.True(ts1.Equals(ts2)); Assert.True(ts1 == ts2); Assert.False(ts1 != ts2); Assert.NotEqual(ts1, ts3); Assert.False(ts1.Equals(ts3)); Assert.False(ts1 == ts3); Assert.True(ts1 != ts3); Assert.NotEqual(ts1, ts4); Assert.False(ts1.Equals(ts4)); Assert.False(ts1 == ts4); Assert.True(ts1 != ts4); }