예제 #1
0
        public void when_template_is_empty_then_text_is_empty()
        {
            StringReplacer replacer = new StringReplacer();
            string text = replacer.Replace(string.Empty);

            Assert.That(text, Is.Empty);
        }
예제 #2
0
        public void when_template_contains_no_placeholder_then_text_equals_template()
        {
            StringReplacer replacer = new StringReplacer();
            string text = replacer.Replace("Hello");

            Assert.That(text == "Hello");
        }
예제 #3
0
        public void when_template_contains_no_placeholder_then_text_equals_template()
        {
            StringReplacer replacer = new StringReplacer();
            string         text     = replacer.Replace("Hello");

            Assert.That(text == "Hello");
        }
예제 #4
0
        public void when_template_is_empty_then_text_is_empty()
        {
            StringReplacer replacer = new StringReplacer();
            string         text     = replacer.Replace(string.Empty);

            Assert.That(text, Is.Empty);
        }
예제 #5
0
        public void when_template_has_unknown_placeholder_then_text_contains_not_placeholder()
        {
            var table = new Dictionary<string, string>
            {
                { "key", "value" }
            };

            StringReplacer replacer = new StringReplacer(table);
            string text = replacer.Replace("$what$");

            Assert.That(text, Is.Empty);
        }
예제 #6
0
        public void when_template_has_multiple_unknown_placeholders_then_text_contains_no_placeholders()
        {
            var table = new Dictionary<string, string>
            {
                { "key", "value" }
            };

            StringReplacer replacer = new StringReplacer(table);
            string text = replacer.Replace("$what$ up $here$");

            Assert.That(text, Is.EqualTo(" up "));
        }
예제 #7
0
        public void when_template_has_known_placeholder_then_text_contains_value_of_placeholder()
        {
            var table = new Dictionary<string, string>
            {
                { "key", "value" }
            };

            StringReplacer replacer = new StringReplacer(table);
            string text = replacer.Replace("$key$");

            Assert.That(text == "value");
        }
예제 #8
0
        public void when_template_has_multiple_unknown_placeholders_then_text_contains_no_placeholders()
        {
            var table = new Dictionary <string, string>
            {
                { "key", "value" }
            };

            StringReplacer replacer = new StringReplacer(table);
            string         text     = replacer.Replace("$what$ up $here$");

            Assert.That(text, Is.EqualTo(" up "));
        }
예제 #9
0
        public void when_template_has_unknown_placeholder_then_text_contains_not_placeholder()
        {
            var table = new Dictionary <string, string>
            {
                { "key", "value" }
            };

            StringReplacer replacer = new StringReplacer(table);
            string         text     = replacer.Replace("$what$");

            Assert.That(text, Is.Empty);
        }
예제 #10
0
        public void when_template_has_known_placeholder_then_text_contains_value_of_placeholder()
        {
            var table = new Dictionary <string, string>
            {
                { "key", "value" }
            };

            StringReplacer replacer = new StringReplacer(table);
            string         text     = replacer.Replace("$key$");

            Assert.That(text == "value");
        }