public void Test1()
        {
            var services = TestDepedencies.Instance.Value;
            var user     = new User();

            user.Register("testUserName");
            user.AddCredits(10000);
            var userIdentity = user.UserIdentity;

            services.UserRepository.AddUser(user);


            var product     = new Product("test name", "test product description", Condition.New);
            var auctionArgs = new AuctionArgs.Builder()
                              .SetBuyNow(20.0m)
                              .SetName("test auction name")
                              .SetStartDate(DateTime.UtcNow.AddMinutes(10))
                              .SetEndDate(DateTime.UtcNow.AddDays(1))
                              .SetCategory(new Category("test", 0))
                              .SetOwner(new UserIdentity()
            {
                UserId = Guid.NewGuid(), UserName = "******"
            })
                              .SetProduct(product)
                              .SetTags(new string[] { "tag1", "tag2" })
                              .Build();
            var auction = new Auction(auctionArgs);
            var sem     = new SemaphoreSlim(0, 1);


            var eventHandler = new Mock <AuctionRaisedHandler>(services.AppEventBuilder,
                                                               services.DbContext, Mock.Of <IRequestStatusService>(), Mock.Of <ILogger <AuctionRaisedHandler> >());

            eventHandler.CallBase = true;
            eventHandler.Setup(f => f.Consume(It.IsAny <IAppEvent <AuctionRaised> >()))
            .Callback(() => sem.Release());


            var requestStatusService = new Mock <IRequestStatusService>();

            requestStatusService.Setup(service =>
                                       service.TrySendNotificationToAll("AuctionPriceChanged", It.IsAny <Dictionary <string, object> >()));

            services.SetupEventBus(eventHandler.Object);

            var stubHandler = new BidCommandHandler(services.AuctionRepository,
                                                    services.EventBus, Mock.Of <ILogger <BidCommandHandler> >(), requestStatusService.Object, services.UserRepository);

            services.AuctionRepository.AddAuction(auction);
            var cmd = new BidCommand(auction.AggregateId, 21.0m);

            cmd.SignedInUser = userIdentity;
            stubHandler.Handle(cmd, CancellationToken.None);


            if (!sem.Wait(TimeSpan.FromSeconds(60)))
            {
                Assert.Fail();
            }
            ;

            eventHandler.Verify(f => f.Consume(It.IsAny <IAppEvent <AuctionRaised> >()), Times.Once);
            requestStatusService.Verify(f => f.TrySendNotificationToAll("AuctionPriceChanged", It.IsAny <Dictionary <string, object> >()), Times.Once());
        }
 public BidCommandHandlerTransactionDecorator(ILogger <BidCommandHandlerTransactionDecorator> logger, BidCommandHandler bidCommandHandler) : base(logger)
 {
     _bidCommandHandler = bidCommandHandler;
 }