コード例 #1
0
 public DictionaryReplacementNotificationContent(IDictionaryReplacementNotificationContentConfiguration dictionaryReplacementNotificationContent, INotificationContent notificationContent, IDictionary <string, string> replacements, string defaultValueIfNoMatch = "[INVALID_TOKEN:{0}]")
 {
     this.Configuration          = dictionaryReplacementNotificationContent;
     this._notificationContent   = notificationContent;
     this._replacements          = replacements;
     this._defaultValueIfNoMatch = defaultValueIfNoMatch;
 }
コード例 #2
0
        private (string, Dictionary <string, string>, string) Get_LotsOfSimpleTemplate_Test_Template(IDictionaryReplacementNotificationContentConfiguration configuration)
        {
            var replacements = new Dictionary <string, string>();

            var tokenStart = configuration.TokenStart;
            var tokenEnd   = configuration.TokenEnd;

            var template = new StringBuilder();
            var expected = new StringBuilder();

            for (var i = 0; i < 1000000; i++)
            {
                var replacement = this.CreateReplacement(replacements);
                var token       = replacement.Item1;
                var value       = replacement.Item2;

                template.Append($"{tokenStart}{token}{tokenEnd}");
                replacements[token] = value;
                expected.Append(value);
            }

            return(template.ToString(), replacements, expected.ToString());
        }