Exemple #1
0
        public void Handle_when_called_twice_increments_views()
        {
            //arrange
            _dbContext.AuctionsReadModel.InsertOne(stubAuction);
            var queryHandler = new AuctionQueryHandler(_dbContext);
            var query        = new AuctionQuery(stubAuction.AuctionId);

            var result1 = queryHandler.Handle(query, CancellationToken.None).Result;
            var result2 = queryHandler.Handle(query, CancellationToken.None).Result;

            result1.Views.Should()
            .Be(0);
            result2.Views.Should()
            .Be(1);
        }
Exemple #2
0
        public void Handle_when_given_valid_page_returns_auction()
        {
            //arrange
            _dbContext.AuctionsReadModel.InsertOne(stubAuction);
            var queryHandler = new AuctionQueryHandler(_dbContext);
            var query        = new AuctionQuery(stubAuction.AuctionId);

            //act
            var result = queryHandler.Handle(query, CancellationToken.None).Result;

            //assert
            result.Should().BeEquivalentTo(stubAuction, config: options =>
            {
                options.Excluding(info => info.StartDate);
                options.Excluding(info => info.EndDate);

                return(options);
            });
        }