Exemple #1
0
 public void ConsumeCorrectlyUpdatesViewStore(
     [Frozen] Mock <IObserver <DateTime> > observerMock,
     MonthViewUpdater sut,
     SoldOutEvent @event)
 {
     sut.Handle(@event);
     observerMock.Verify(s => s.OnNext(@event.Date));
 }
Exemple #2
0
        public void Consume(MakeReservationCommand message)
        {
            var blob             = this.GetCapacityBlob(message);
            var originalCapacity = blob.DownloadItem();

            var newCapacity = originalCapacity.Reserve(
                message.Quantity, message.Id);

            if (!newCapacity.Equals(originalCapacity))
            {
                blob.Upload(newCapacity);
                if (newCapacity.Remaining <= 0)
                {
                    var e = new SoldOutEvent(message.Date);
                    this.channel.Send(e);
                }
            }
        }
Exemple #3
0
        public void EnvelopReturnsCorrectBody(SoldOutEvent sut)
        {
            var actual = sut.Envelop();

            Assert.Equal(sut, actual.Body);
        }
Exemple #4
0
 public void DateIsCorrect([Frozen] DateTime date, SoldOutEvent sut)
 {
     Assert.Equal <DateTime>(date, sut.Date);
 }
Exemple #5
0
 public void IdIsStable(SoldOutEvent sut)
 {
     Assert.Equal(sut.Id, sut.Id);
 }
Exemple #6
0
 public void IdIsUnique(SoldOutEvent sut, SoldOutEvent other)
 {
     Assert.NotEqual(sut.Id, other.Id);
 }
Exemple #7
0
 public void SutIsMessage(SoldOutEvent sut)
 {
     Assert.IsAssignableFrom <IMessage>(sut);
 }
Exemple #8
0
 public void ConsumeCorrectlyUpdatesViewStore([Frozen] Mock <IMonthViewWriter> storeMock, MonthViewModelUpdater sut, SoldOutEvent @event)
 {
     sut.Consume(@event);
     storeMock.Verify(s => s.Disable(@event.Date));
 }