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)); }
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)); }
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; }