コード例 #1
0
        private CommandResult HandleCommand(State state, CommandPayload payload)
        {
            switch (payload)
            {
            case CreateAuction createAuction:
                return(CreateAuctionHandler.Handle(state, createAuction));

            case PlaceBid placeBid:
                return(PlaceBidHandler.Handle(state, placeBid));

            default:
                return(CommandResultFailure.Create("Unknown command payload type"));
            }
        }
コード例 #2
0
 public PlaceBidForm(ClientModel model, PlaceBidHandler placeBidHandler, ProductListViewHandler productListViewHandler)
 {
     this.itsModel = model;
     this.itsState = ClientState.UNAUTENTIZED;
     this.handleProductListClick = productListViewHandler;
     this.placeBidHandler        = placeBidHandler;
     this.updateObserver         = this.update;
     this.Show();
     this.Hide();
     InitializeComponent();
     this.Invoke(new Action(() =>
     {
         update(this.itsState);
     }));
 }
コード例 #3
0
        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)
            };
        }