public void Record(EventId expectedLastEventId, params IEvent[] events) { try { _lock.TryWrite(() => { var nextEventNumber = _repo.Count; Check_for_version_conflict(expectedLastEventId); Store_all_events(nextEventNumber); }); OnRecorded(events); } finally { } void Check_for_version_conflict(EventId expectedLastEventId) { if (expectedLastEventId != null && expectedLastEventId.Equals(LastEventId) is false) { throw new VersionNotFoundException($"Event store version conflict! Version '{expectedLastEventId}' expected, but is '{LastEventId}'!"); } } void Store_all_events(long eventNumber) => events.ToList().ForEach(e => _repo.Store(eventNumber++, e)); }
protected bool Equals(Ticket other) { return(base.Equals(other) && SeatNumber == other.SeatNumber && Price.Equals(other.Price) && EventId.Equals(other.EventId) && Nullable.Equals(UserId, other.UserId) && UserName == other.UserName && Nullable.Equals(PurchaseDate, other.PurchaseDate)); }
/// <summary> /// Returns true if NotificationViewModel instances are equal /// </summary> /// <param name="other">Instance of NotificationViewModel to be compared</param> /// <returns>Boolean</returns> public bool Equals(NotificationViewModel other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( EventId == other.EventId || EventId != null && EventId.Equals(other.EventId) ) && ( Event2Id == other.Event2Id || Event2Id != null && Event2Id.Equals(other.Event2Id) ) && ( HasBeenViewed == other.HasBeenViewed || HasBeenViewed != null && HasBeenViewed.Equals(other.HasBeenViewed) ) && ( IsWatchNotification == other.IsWatchNotification || IsWatchNotification != null && IsWatchNotification.Equals(other.IsWatchNotification) ) && ( IsExpired == other.IsExpired || IsExpired != null && IsExpired.Equals(other.IsExpired) ) && ( IsAllDay == other.IsAllDay || IsAllDay != null && IsAllDay.Equals(other.IsAllDay) ) && ( PriorityCode == other.PriorityCode || PriorityCode != null && PriorityCode.Equals(other.PriorityCode) ) && ( UserId == other.UserId || UserId != null && UserId.Equals(other.UserId) )); }
public void AssertThat_IdenticalEventIds_AreEqual() { var eventId1 = new EventId(42, "event"); var eventId2 = new EventId(42, "event"); Assert.True(eventId1.Equals(eventId2), "eventId1.Equals(eventId2)"); Assert.True(eventId1 == eventId2, "eventId1 == eventId2"); Assert.Equal(eventId1, eventId2); }
public void CompareEventId() { EventId event1 = 1; EventId event1Bis = new EventId(1, "one"); EventId event2 = 2; Assert.Equal(event1.Id, event1Bis.Id); Assert.True(event1.Equals(event1Bis)); Assert.True(event1 == event1Bis); Assert.True(event1 != event2); }
public bool Equals(StoredEvent other) { if (ReferenceEquals(this, other)) { return(true); } if (ReferenceEquals(null, other)) { return(false); } return(EventId.Equals(other.EventId)); }
/// <summary> /// Returns true if MarketDefinition instances are equal /// </summary> /// <param name="other">Instance of MarketDefinition to be compared</param> /// <returns>Boolean</returns> public bool Equals(MarketDefinition other) { // credit: http://stackoverflow.com/a/10454552/677735 if (other == null) { return(false); } return((Venue == other.Venue || Venue != null && Venue.Equals(other.Venue)) && (SettledTime == other.SettledTime || SettledTime != null && SettledTime.Equals(other.SettledTime)) && (Timezone == other.Timezone || Timezone != null && Timezone.Equals(other.Timezone)) && (EachWayDivisor == other.EachWayDivisor || EachWayDivisor != null && EachWayDivisor.Equals(other.EachWayDivisor)) && (Regulators == other.Regulators || Regulators != null && Regulators.SequenceEqual(other.Regulators)) && (MarketType == other.MarketType || MarketType != null && MarketType.Equals(other.MarketType)) && (MarketBaseRate == other.MarketBaseRate || MarketBaseRate != null && MarketBaseRate.Equals(other.MarketBaseRate)) && (NumberOfWinners == other.NumberOfWinners || NumberOfWinners != null && NumberOfWinners.Equals(other.NumberOfWinners)) && (CountryCode == other.CountryCode || CountryCode != null && CountryCode.Equals(other.CountryCode)) && (InPlay == other.InPlay || InPlay != null && InPlay.Equals(other.InPlay)) && (BetDelay == other.BetDelay || BetDelay != null && BetDelay.Equals(other.BetDelay)) && (BspMarket == other.BspMarket || BspMarket != null && BspMarket.Equals(other.BspMarket)) && (BettingType == other.BettingType || BettingType != null && BettingType.Equals(other.BettingType)) && (NumberOfActiveRunners == other.NumberOfActiveRunners || NumberOfActiveRunners != null && NumberOfActiveRunners.Equals(other.NumberOfActiveRunners)) && (EventId == other.EventId || EventId != null && EventId.Equals(other.EventId)) && (CrossMatching == other.CrossMatching || CrossMatching != null && CrossMatching.Equals(other.CrossMatching)) && (RunnersVoidable == other.RunnersVoidable || RunnersVoidable != null && RunnersVoidable.Equals(other.RunnersVoidable)) && (TurnInPlayEnabled == other.TurnInPlayEnabled || TurnInPlayEnabled != null && TurnInPlayEnabled.Equals(other.TurnInPlayEnabled)) && (SuspendTime == other.SuspendTime || SuspendTime != null && SuspendTime.Equals(other.SuspendTime)) && (DiscountAllowed == other.DiscountAllowed || DiscountAllowed != null && DiscountAllowed.Equals(other.DiscountAllowed)) && (PersistenceEnabled == other.PersistenceEnabled || PersistenceEnabled != null && PersistenceEnabled.Equals(other.PersistenceEnabled)) && (Runners == other.Runners || Runners != null && Runners.SequenceEqual(other.Runners)) && (Version == other.Version || Version != null && Version.Equals(other.Version)) && (EventTypeId == other.EventTypeId || EventTypeId != null && EventTypeId.Equals(other.EventTypeId)) && (Complete == other.Complete || Complete != null && Complete.Equals(other.Complete)) && (OpenDate == other.OpenDate || OpenDate != null && OpenDate.Equals(other.OpenDate)) && (MarketTime == other.MarketTime || MarketTime != null && MarketTime.Equals(other.MarketTime)) && (BspReconciled == other.BspReconciled || BspReconciled != null && BspReconciled.Equals(other.BspReconciled)) && (Status == other.Status || Status != null && Status.Equals(other.Status))); }
/// <summary> /// Returns true if Feedback instances are equal /// </summary> /// <param name="other">Instance of Feedback to be compared</param> /// <returns>Boolean</returns> public bool Equals(Feedback other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( EventId == other.EventId || EventId != null && EventId.Equals(other.EventId) ) && ( Topic == other.Topic || Topic != null && Topic.Equals(other.Topic) ) && ( Rating == other.Rating || Rating != null && Rating.Equals(other.Rating) ) && ( Comment == other.Comment || Comment != null && Comment.Equals(other.Comment) ) && ( Sentiment == other.Sentiment || Sentiment != null && Sentiment.Equals(other.Sentiment) )); }
public bool Equals(DomainEvent <TAggregateId> other) { return(other != null && EventId.Equals(other.EventId)); }
public bool Equals(DomainEventBase <TStreamId> other) { return(other != null && EventId.Equals(other.EventId)); }
public bool Equals(EventBase other) { return(other != null && EventId.Equals(other.EventId)); }