示例#1
0
        public void Handle(PlaceBidCommand command)
        {
            var auction = auctionRepository.Get(command.AuctionId);

            auction.PlaceBid(command.BidderId, command.Amount);
            auctionRepository.Update(auction);
        }
        public PlaceBidHandlerTests()
        {
            _bidRepository         = new Mock <IBidRepository>();
            _auctionItemRepository = new Mock <IAuctionItemRepository>();
            _placeBidHandler       = new PlaceBidHandler(_bidRepository.Object, _auctionItemRepository.Object);
            testCommand            = new PlaceBidCommand()
            {
                UserId = 1,
                Price  = 120,
                ItemId = testItemId1
            };

            testAuctionItem = new AuctionItem()
            {
                ItemId       = testItemId1,
                MinIncrement = 20,
                Startprice   = 50,
                SellerUserId = 2,
                EndTime      = DateTimeOffset.UtcNow.AddHours(1)
            };
        }
 public void Post(PlaceBidCommand command)
 {
     _bus.Dispatch(command);
 }
示例#4
0
        public async Task <IActionResult> PlaceBid([FromBody] PlaceBidCommand bidCommand)
        {
            var result = await _mediator.Send(bidCommand);

            return(Ok(result));
        }
 public void SetUp()
 {
     processor = new Mock <IAuctionProcessor>();
     log       = new Mock <ILogger <PlaceBidCommand> >();
     target    = new PlaceBidCommand(processor.Object, log.Object);
 }
示例#6
0
 public IActionResult Post(long id, PlaceBidCommand command)
 {
     command.AuctionId = id;
     _commandDispatcher.Dispatch(command);
     return(Ok());
 }
 public IActionResult Post(Guid id, PlaceBidCommand command)
 {
     commandBus.Dispatch(command);
     return(Ok());
 }
示例#8
0
 public void Handle(PlaceBidCommand command)
 {
     throw new NotImplementedException();
 }