public async Task WhenAuctionItemAddedThenItemIsAddedToAuctionReadModel()
        {
            var @event = new AuctionItemAddedEvent(_auctionId, new AuctionItem("something", "boy"));

            await _handler.HandleAsync(@event);

            Assert.Single(_readStore.GetAll <AuctionItemReadModel>());
        }
        public async Task WhenAuctionItemRemovedThenItemIsDeletedFromAuction()
        {
            var @event = new AuctionItemRemovedEvent(_auctionId, "idk");

            await _handler.HandleAsync(@event);

            Assert.Empty(_readStore.GetAll <AuctionItemReadModel>());
        }
        public async Task WhenAuctionCreatedThenAuctionIsAddedToReadStore()
        {
            var @event = new AuctionCreatedEvent(new AuctionId(), "one", DateTimeOffset.UtcNow);

            await _handler.HandleAsync(@event);

            Assert.Single(_readStore.GetAll <AuctionReadModel>());
        }
예제 #4
0
        public async Task WhenAuctionIsUpdatedThenAuctionReadModelIsUpdated()
        {
            var @event = new AuctionUpdatedEvent(_auctionId, "new-hotness", DateTimeOffset.UtcNow);

            await _handler.HandleAsync(@event);

            var auction = _readStore.GetAll <AuctionReadModel>().Single();

            Assert.Equal("new-hotness", auction.Name);
            Assert.Equal(@event.AuctionDate, auction.AuctionDate);
        }
예제 #5
0
        public async Task WhenAuctionItemIsUpdatedThenReadAuctionItemIsUpdatedFromEvent()
        {
            var @event = new AuctionItemUpdatedEvent(
                _auctionId,
                "existing",
                "newhotness",
                "new donor",
                "descripty",
                12);

            await _handler.HandleAsync(@event);

            var item = _readStore.GetAll <AuctionItemReadModel>().Single();

            Assert.Equal("newhotness", item.Name);
            Assert.Equal("new donor", item.Donor);
            Assert.Equal("descripty", item.Description);
            Assert.Equal(12, item.Quantity);
        }