Esempio n. 1
0
 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);
        }
Esempio n. 3
0
            public void ConcertIsPlannedWithIdAndValidCapacity()
            {
                var id = new ConcertId(Guid.NewGuid());

                new ConstructorScenarioFor <Concert>(() => Concert.Plan(id, 100)).
                Then(ConcertEvents.Planned(id)).
                Assert();
            }
Esempio n. 4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = TicketSaleId.GetHashCode();
         hashCode = (hashCode * 397) ^ ConcertId.GetHashCode();
         hashCode = (hashCode * 397) ^ Date.GetHashCode();
         return(hashCode);
     }
 }
Esempio n. 5
0
                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);
                }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
 public SeatType(SeatTypeId id, ConcertId concertId, string name, int quantity, Money price)
 {
     Construct(id, concertId, name, quantity, price);
 }
Esempio n. 8
0
        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));
        }
Esempio n. 9
0
 bool IEquatable <Concert> .Equals(Concert other)
 {
     return(ConcertId.Equals(other.ConcertId));
 }
Esempio n. 10
0
 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);
        }
Esempio n. 12
0
 protected bool Equals(TicketSaleStartedEvent other)
 {
     return(TicketSaleId.Equals(other.TicketSaleId) && ConcertId.Equals(other.ConcertId) &&
            Date.Equals(other.Date));
 }
Esempio n. 13
0
 protected bool Equals(ConcertCancelledEvent other)
 {
     return(ConcertId.Equals(other.ConcertId) && string.Equals(Reason, other.Reason));
 }
Esempio n. 14
0
 public override int GetHashCode()
 {
     return(ConcertId.GetHashCode());
 }
Esempio n. 15
0
 protected bool Equals(ConcertPlannedEvent other)
 {
     return(ConcertId.Equals(other.ConcertId));
 }
Esempio n. 16
0
 void When(ConcertPlannedEvent @event)
 {
     _id        = new ConcertId(@event.ConcertId);
     _cancelled = false;
 }