Esempio n. 1
0
        public void Constructor_ConfirmationServiceNull_Throws()
        {
            var stubDecoratee  = Substitute.For <ICommandService <TranslateSubtitlesFileToNewFile> >();
            var stubCalculator = Substitute.For <ISubtitlesFileCostCalculator>();
            IUserConfirmationService nullConfirmationService = null;

            Assert.Throws <ArgumentNullException>(
                () => new TranslationCostConfirmationDecorator(
                    stubDecoratee, stubCalculator, nullConfirmationService));
        }
Esempio n. 2
0
        private TranslationCostConfirmationDecorator CreateDecorator(
            ICommandService <TranslateSubtitlesFileToNewFile> decoratee,
            IUserConfirmationService confirmationService)
        {
            var stubCalculator = Substitute.For <ISubtitlesFileCostCalculator>();

            stubCalculator
            .Calculate(Arg.Any <FilePath>())
            .Returns(new Price(5, Currency.Euro));

            return(new TranslationCostConfirmationDecorator(
                       decoratee,
                       stubCalculator,
                       confirmationService));
        }
Esempio n. 3
0
        public TranslationCostConfirmationDecorator(
            ICommandService <TranslateSubtitlesFileToNewFile> decoratee,
            ISubtitlesFileCostCalculator costCalculator,
            IUserConfirmationService confirmationService)
        {
            if (decoratee == null)
            {
                throw new ArgumentNullException(nameof(decoratee));
            }
            if (costCalculator == null)
            {
                throw new ArgumentNullException(nameof(decoratee));
            }
            if (confirmationService == null)
            {
                throw new ArgumentNullException(nameof(confirmationService));
            }

            this.decoratee           = decoratee;
            this.costCalculator      = costCalculator;
            this.confirmationService = confirmationService;
        }