コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
        }