Пример #1
0
        public void EstaVacio()
        {
            var dic    = new Dictionary <string, string>();
            var obj    = new DictionaryReplacer();
            var result = obj.Replace("", dic);

            Assert.AreEqual("", result);
        }
Пример #2
0
        public void EsNulo()
        {
            Dictionary <string, string> dic = null;
            var obj    = new DictionaryReplacer();
            var result = obj.Replace("", dic);

            Assert.AreEqual("", result);
        }
Пример #3
0
        public void Test3()
        {
            string output = DictionaryReplacer.Replace("$temp$ here comes the name $name$", new Dictionary <string, string>()
            {
                { "temp", "temporary" }, { "name", "John Doe" }
            });

            Assert.Equal("temporary here comes the name John Doe", output);
        }
Пример #4
0
        public void Test2()
        {
            string output = DictionaryReplacer.Replace("$temp$", new Dictionary <string, string>()
            {
                { "temp", "temporary" }
            });

            Assert.Equal("temporary", output);
        }
Пример #5
0
        public void MuestraNombre()
        {
            var texto = "$nombre$";
            var dic   = new Dictionary <string, string>();

            dic.Add("nombre", "Juan");

            var obj    = new DictionaryReplacer();
            var result = obj.Replace(texto, dic);

            Assert.AreEqual("Juan", result);
        }
Пример #6
0
        public void MuestraTextoOriginal()
        {
            var texto = "texto sin ninguna clave";
            var dic   = new Dictionary <string, string>();

            dic.Add("nombre", "Juan");
            dic.Add("edad", "27");

            var obj    = new DictionaryReplacer();
            var result = obj.Replace(texto, dic);

            Assert.AreEqual(texto, result);
        }
Пример #7
0
        public void MuestraNombreYEdad()
        {
            var texto = "$nombre$ tiene $edad$ años";
            var dic   = new Dictionary <string, string>();

            dic.Add("nombre", "Juan");
            dic.Add("edad", "27");

            var obj    = new DictionaryReplacer();
            var result = obj.Replace(texto, dic);

            Assert.AreEqual("Juan tiene 27 años", result);
        }
Пример #8
0
        public void Test1()
        {
            string output = DictionaryReplacer.Replace("", new Dictionary <string, string>());

            Assert.Equal("", output);
        }
 public void CanCreate()
 {
     replacer = new DictionaryReplacer();
     Assert.NotNull(replacer);
 }