Esempio n. 1
0
        public void when_template_is_emply_then_text_is_empty()
        {
            var template = string.Empty;
            var replacer = new StringReplacer(table: null);

            var text = replacer.Replace(template);

            Assert.Equal(string.Empty, text);
        }
Esempio n. 2
0
        public void when_template_contains_no_placeholder_then_text_equals_template()
        {
            var template = "Test";
            var replacer = new StringReplacer(table: null);

            var text = replacer.Replace(template);

            Assert.Equal("Test", text);
        }
Esempio n. 3
0
        public void when_template_is_emply_then_text_is_empty()
        {
            var template = string.Empty;
            var replacer = new StringReplacer(table: null);

            var text = replacer.Replace(template);

            Assert.Equal(string.Empty, text);
        }
Esempio n. 4
0
        public void when_template_contains_no_placeholder_then_text_equals_template()
        {
            var template = "Test";
            var replacer = new StringReplacer(table: null);

            var text = replacer.Replace(template);

            Assert.Equal("Test", text);
        }
Esempio n. 5
0
        public void when_template_has_unknown_placeholder_then_text_does_not_contain_that_placeholder()
        {
            var table = new Dictionary<string, string>() {
                {"key", "value"}
            };

            var template = "$what$";
            var replacer = new StringReplacer(table);

            var text = replacer.Replace(template);

            Assert.Equal(string.Empty, text);
        }
Esempio n. 6
0
        public void when_template_has_known_placeholder_then_text_contains_corresponding_value()
        {
            var table = new Dictionary<string, string>() {
                {"key", "value"}
            };

            var template = "$key$";
            var replacer = new StringReplacer(table);

            var text = replacer.Replace(template);

            Assert.Equal("value", text);
        }
Esempio n. 7
0
        public void when_template_has_more_than_one_unknown_placeholder_then_text_does_not_contain_that_placeholder()
        {
            var table = new Dictionary <string, string>()
            {
                { "key", "value" }
            };

            var template = "$what$$key$$isit$";
            var replacer = new StringReplacer(table);

            var text = replacer.Replace(template);

            Assert.Equal("value", text);
        }
Esempio n. 8
0
        public void when_template_has_known_placeholder_then_text_contains_corresponding_value()
        {
            var table = new Dictionary <string, string>()
            {
                { "key", "value" }
            };

            var template = "$key$";
            var replacer = new StringReplacer(table);

            var text = replacer.Replace(template);

            Assert.Equal("value", text);
        }