예제 #1
0
        public void Return_Only_Auction_Already_To_Open(int openingDateToAdd, int quantityToGet)
        {
            var openingDate = DateTime.Now.AddDays(openingDateToAdd);

            var updateDateOpeningStrategy = _auctionStrategyFactory.Make <UpdateOpeningParameter>(StrategyTypeEnum.UpdateOpeningDate);
            var parameters = new UpdateOpeningParameter(openingDate);

            _auction2.Update(updateDateOpeningStrategy, parameters);
            _sut = new Auctions(_originalListOfAuctions);


            Assert.Equal(quantityToGet, _sut.ReadyToOpen().Get().Count());
        }
예제 #2
0
        public void Update_Opening_Date()
        {
            var now = DateTime.Now;
            var auctionsDecoratorsFactory = new AuctionsMilestonesDecoratorsFactory();

            var decoratorAuctionMilestone = auctionsDecoratorsFactory.Make <UpdateOpeningParameter>(DecoratorsEnum.DecoratorAuctionMilestone);

            var updateOpeningParameter = new UpdateOpeningParameter(now);

            decoratorAuctionMilestone.SetStrategy(_updateOpeningDateStrategy);

            var auctionsDecoratorsChainOfResponsibilityFactory = new AuctionsMilestoneDecoratorsChainOfResponsibilityFactory();

            var openingDateStep = auctionsDecoratorsChainOfResponsibilityFactory.Make <Auction, UpdateOpeningParameter>(AuctionsChainOfResponsibilityEnum.MilestoneOpeningDateStepAction);
            var providerStep    = auctionsDecoratorsChainOfResponsibilityFactory.Make <Auction, UpdateOpeningParameter>(AuctionsChainOfResponsibilityEnum.MilestoneProvidersStepAction);

            openingDateStep.SetSuccessor(providerStep);

            decoratorAuctionMilestone.SetStepsToProcess(openingDateStep);

            Sut.Update <UpdateOpeningParameter>(decoratorAuctionMilestone, updateOpeningParameter);
        }