コード例 #1
0
        public MessageTokenProvider(ILanguageService languageService,
            ILocalizationService localizationService, IDateTimeHelper dateTimeHelper,
            IEmailAccountService emailAccountService,
            IPriceFormatter priceFormatter, ICurrencyService currencyService,IWebHelper webHelper,
            IWorkContext workContext, IDownloadService downloadService,
            IOrderService orderService, IPaymentService paymentService,
            IProductAttributeParser productAttributeParser,
            StoreInformationSettings storeSettings, MessageTemplatesSettings templatesSettings,
            EmailAccountSettings emailAccountSettings, CatalogSettings catalogSettings,
            TaxSettings taxSettings, IEventPublisher eventPublisher)
        {
            this._languageService = languageService;
            this._localizationService = localizationService;
            this._dateTimeHelper = dateTimeHelper;
            this._emailAccountService = emailAccountService;
            this._priceFormatter = priceFormatter;
            this._currencyService = currencyService;
            this._webHelper = webHelper;
            this._workContext = workContext;
            this._downloadService = downloadService;
            this._orderService = orderService;
            this._paymentService = paymentService;
            this._productAttributeParser = productAttributeParser;

            this._storeSettings = storeSettings;
            this._templatesSettings = templatesSettings;
            this._emailAccountSettings = emailAccountSettings;
            this._catalogSettings = catalogSettings;
            this._taxSettings = taxSettings;
            this._eventPublisher = eventPublisher;
        }
コード例 #2
0
ファイル: TokenizerTests.cs プロジェクト: vic0626/nas-merk
        public void Can_replace_tokens_case_invariant()
        {
            var messageTemplatesSettings = new MessageTemplatesSettings()
            {
                CaseInvariantReplacement = true
            };
            var tokenizer = new Tokenizer(messageTemplatesSettings);

            var tokens = new List<Token>()
            {
                new Token("Token1", "Value1")
            };
            tokenizer
                .Replace("Some text %TOKEn1%", tokens, false)
                .ShouldEqual("Some text Value1");
        }
コード例 #3
0
ファイル: TokenizerTests.cs プロジェクト: vic0626/nas-merk
        public void Should_not_html_encode_if_token_doesnt_allow_it()
        {
            var messageTemplatesSettings = new MessageTemplatesSettings()
            {
                CaseInvariantReplacement = false
            };
            var tokenizer = new Tokenizer(messageTemplatesSettings);

            var tokens = new List<Token>()
            {
                new Token("Token1", "<Value1>", true)
            };

            tokenizer
                .Replace("Some text %Token1%", tokens, true)
                .ShouldEqual("Some text <Value1>");
        }
コード例 #4
0
ファイル: TokenizerTests.cs プロジェクト: vic0626/nas-merk
        public void Can_html_encode()
        {
            var messageTemplatesSettings = new MessageTemplatesSettings()
            {
                CaseInvariantReplacement = false
            };
            var tokenizer = new Tokenizer(messageTemplatesSettings);

            var tokens = new List<Token>()
            {
                new Token("Token1", "<Value1>")
            };

            tokenizer
                .Replace("Some text %Token1%", tokens, true)
                .ShouldEqual("Some text &lt;Value1&gt;");
        }
コード例 #5
0
ファイル: TokenizerTests.cs プロジェクト: vic0626/nas-merk
        public void Can_replace_tokens_case_sensitive()
        {
            var messageTemplatesSettings = new MessageTemplatesSettings()
            {
                CaseInvariantReplacement = false
            };
            var tokenizer = new Tokenizer(messageTemplatesSettings);

            var tokens = new List<Token>()
            {
                new Token("Token1", "Value1")
            };
            //correct case
            tokenizer
                .Replace("Some text %Token1%", tokens, false)
                .ShouldEqual("Some text Value1");
            //wrong case
            tokenizer
                .Replace("Some text %TOKeN1%", tokens, false)
                .ShouldEqual("Some text %TOKeN1%");
        }
コード例 #6
0
ファイル: Tokenizer.cs プロジェクト: vic0626/nas-merk
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="settings">Message templates settings</param>
 public Tokenizer(MessageTemplatesSettings settings)
 {
     _stringComparison = settings.CaseInvariantReplacement ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
 }