public void Parsing_Roundtrip() { var actual = new KaVEVersion("0.123-Development"); var expected = new KaVEVersion(123, Variant.Development); Assert.AreEqual(expected, actual); }
public void Equality_DifferentVariant() { var a = new KaVEVersion(123, Variant.Development); var b = new KaVEVersion(123, Variant.Default); Assert.AreNotEqual(a, b); Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode()); }
public void Equality_ReallyTheSame() { var a = new KaVEVersion(123, Variant.Development); var b = new KaVEVersion(123, Variant.Development); Assert.AreEqual(a, b); Assert.AreEqual(a.GetHashCode(), b.GetHashCode()); }
public void Init_WithString() { var sut = new KaVEVersion("0.123-Development"); Assert.AreEqual(new Version(0, 123), sut.Version); Assert.AreEqual(Variant.Development, sut.Variant); Assert.AreEqual(123, sut.ReleaseNumber); }
public void Init_WithValues() { var sut = new KaVEVersion(123, Variant.Development); Assert.AreEqual(new Version(0, 123), sut.Version); Assert.AreEqual(Variant.Development, sut.Variant); Assert.AreEqual(123, sut.ReleaseNumber); }
public override int GetHashCode() { unchecked { var hashCode = StartTime.GetHashCode(); hashCode = (hashCode * 397) ^ Duration.GetHashCode(); hashCode = (hashCode * 397) ^ UserId.GetHashCode(); hashCode = (hashCode * 397) ^ IDESessionId.GetHashCode(); hashCode = (hashCode * 397) ^ (KaVEVersion != null ? KaVEVersion.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Project.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = (Id != null ? Id.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (IDESessionUUID != null ? IDESessionUUID.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (KaVEVersion != null ? KaVEVersion.GetHashCode() : 0); hashCode = (hashCode * 397) ^ TriggeredAt.GetHashCode(); hashCode = (hashCode * 397) ^ (int)TriggeredBy; hashCode = (hashCode * 397) ^ Duration.GetHashCode(); hashCode = (hashCode * 397) ^ (ActiveWindow != null ? ActiveWindow.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ActiveDocument != null ? ActiveDocument.GetHashCode() : 0); return(hashCode); } }
public IEnumerable <Interval> TransformWithCustomTransformer(IEnumerable <IDEEvent> events, IEventToIntervalTransformer <Interval> transformer) { events = _fixer.FixAndFilter(events); _logger.Info(@"Transforming event stream with {0} ...", transformer.GetType().Name); var currentEventTime = DateTimeOffset.MinValue; var i = 0; foreach (var e in events) { i++; if (i % 500 == 0) { Console.Write('.'); } if (i % 50000 == 0) { Console.WriteLine(); } if (TransformerUtils.EventHasNoTimeData(e)) { continue; } var version = new KaVEVersion(e.KaVEVersion); if (version.ReleaseNumber < _firstVersionToInclude) { continue; } Asserts.IsLessOrEqual(currentEventTime, e.TriggeredAt.GetValueOrDefault()); currentEventTime = e.TriggeredAt.GetValueOrDefault(); transformer.ProcessEvent(e); } Console.WriteLine(); _logger.Info("--> Done processing {0} events...", i); return(transformer.SignalEndOfEventStream()); }
public void ToStringIsImplemented() { var sut = new KaVEVersion(1234, Variant.Development); Assert.AreEqual("0.1234-Development", sut.ToString()); }