Example #1
0
        public void Constructor_NullCostCalculator_Throws()
        {
            var stubDecoratee = Substitute.For <ICommandService <TranslateSubtitlesFileToNewFile> >();
            ISubtitlesFileCostCalculator nullCalculator = null;
            var stubConfirmationService = Substitute.For <IUserConfirmationService>();

            Assert.Throws <ArgumentNullException>(
                () => new TranslationCostConfirmationDecorator(
                    stubDecoratee, nullCalculator, stubConfirmationService));
        }
Example #2
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;
        }