public override int GetHashCode() { unchecked { return((ConcertId.GetHashCode() * 397) ^ Reason.GetHashCode()); } }
public void ConcertConstruction_WhenPassingConcertIdManualy_IsSameAsConcertIdentity() { var concertId = new ConcertId(Guid.NewGuid().ToString()); var sut = AnonymousConcert(concertId); Assert.Equal <string>(concertId.Value, sut.Identity); }
public void ConcertIsPlannedWithIdAndValidCapacity() { var id = new ConcertId(Guid.NewGuid()); new ConstructorScenarioFor <Concert>(() => Concert.Plan(id, 100)). Then(ConcertEvents.Planned(id)). Assert(); }
public override int GetHashCode() { unchecked { var hashCode = TicketSaleId.GetHashCode(); hashCode = (hashCode * 397) ^ ConcertId.GetHashCode(); hashCode = (hashCode * 397) ^ Date.GetHashCode(); return(hashCode); } }
public static Concert Plan(ConcertId id, int venueCapacity) { if (venueCapacity < 1) { throw new ArgumentException("venueCapacity"); } var concert = Factory(); concert.Apply(ConcertEvents.Planned(id)); return(concert); }
private void Construct(SeatTypeId id, ConcertId concertId, string name, int quantity, Money price) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("not be null or empty", nameof(name)); } if (quantity <= 0) { throw new ArgumentException("must be greater than zero", nameof(name)); } Id = id ?? new SeatTypeId(); ConcertId = concertId ?? throw new ArgumentNullException(nameof(concertId)); Name = name; Quantity = quantity; Price = price ?? throw new ArgumentNullException(nameof(price)); }
public SeatType(SeatTypeId id, ConcertId concertId, string name, int quantity, Money price) { Construct(id, concertId, name, quantity, price); }
public SeatType(ConcertId concertId, string name, int quantity, Money price) { Construct(null, concertId, name, quantity, price); this.Apply(new SeatTypeCreated(new SeatTypeSnapshotProvider(this).Snapshot, ConcertId)); }
bool IEquatable <Concert> .Equals(Concert other) { return(ConcertId.Equals(other.ConcertId)); }
public SeatTypeCreated(SeatTypeSnapshot snapshot, ConcertId concertId) { SeatType = new SeatTypeMessage(snapshot.Id, snapshot.Name, snapshot.Quantity, snapshot.Price); ConcertId = concertId.Value; }
private Concert AnonymousConcert(ConcertId id = null, DateTime?concertDate = null, string title = null) { var concert = concertFactory.Create(id ?? new ConcertId(), title ?? "a", "b", "c", concertDate ?? DateTime.Now.AddDays(2)); return(concert); }
protected bool Equals(TicketSaleStartedEvent other) { return(TicketSaleId.Equals(other.TicketSaleId) && ConcertId.Equals(other.ConcertId) && Date.Equals(other.Date)); }
protected bool Equals(ConcertCancelledEvent other) { return(ConcertId.Equals(other.ConcertId) && string.Equals(Reason, other.Reason)); }
public override int GetHashCode() { return(ConcertId.GetHashCode()); }
protected bool Equals(ConcertPlannedEvent other) { return(ConcertId.Equals(other.ConcertId)); }
void When(ConcertPlannedEvent @event) { _id = new ConcertId(@event.ConcertId); _cancelled = false; }