Ejemplo n.º 1
0
        private void SetUpCommandHandler()
        {
            var services = TestDepedencies.Instance.Value;

            var userRepository = new Mock <IUserRepository>();

            userRepository.Setup(f => f.FindUser(It.IsAny <UserIdentity>()))
            .Returns(user);

            session.AddOrReplaceImage(new AuctionImage("img1-1",
                                                       "img1-2", "img1-3"), 0);
            services.AuctionImageRepository.Add("img1-1", new AuctionImageRepresentation(new AuctionImageMetadata("jpg"), File.ReadAllBytes("./test_image.jpg")));
            var sessionService = services.GetAuctionCreateSessionService(session);

            var handlerDepedencies = new CreateAuctionCommandHandlerDepedencies()
            {
                auctionRepository       = services.AuctionRepository,
                auctionSchedulerService = services.SchedulerService,
                eventBusService         = services.EventBus,
                logger = Mock.Of <ILogger <CreateAuctionCommandHandler> >(),
                auctionCreateSessionService = sessionService,
                auctionImageRepository      = services.AuctionImageRepository,
                categoryBuilder             = new CategoryBuilder(services.CategoryTreeService),
                userRepository = userRepository.Object
            };

            commandHandler = new CreateAuctionCommandHandler(handlerDepedencies);
        }
        public CreateAuctionCommandHandlerTest()
        {
            _eventStore = new InMemoryEventStore();

            _handler = new CreateAuctionCommandHandler(_eventStore);
        }