public void ConvertToStringTest()
        {
            var converter = new CharConverter();

            Assert.Equal("a", converter.ConvertToString('a'));

            Assert.Equal("True", converter.ConvertToString(true));

            Assert.Equal("", converter.ConvertToString(null));
        }
Exemple #2
0
        public void ConvertToStringTest()
        {
            var converter = new CharConverter();

            Assert.AreEqual("a", converter.ConvertToString(CultureInfo.CurrentCulture, 'a'));

            Assert.AreEqual("True", converter.ConvertToString(CultureInfo.CurrentCulture, true));

            Assert.AreEqual("", converter.ConvertToString(CultureInfo.CurrentCulture, null));
        }
        public void ConvertToStringTest()
        {
            var converter            = new CharConverter();
            var typeConverterOptions = new TypeConverterOptions
            {
                CultureInfo = CultureInfo.CurrentCulture
            };

            Assert.AreEqual("a", converter.ConvertToString(typeConverterOptions, 'a'));

            Assert.AreEqual("True", converter.ConvertToString(typeConverterOptions, true));

            Assert.AreEqual("", converter.ConvertToString(typeConverterOptions, null));
        }
        public void ConvertToStringTest()
        {
            var converter       = new CharConverter();
            var propertyMapData = new MemberMapData(null)
            {
                TypeConverter        = converter,
                TypeConverterOptions = { CultureInfo = CultureInfo.CurrentCulture }
            };

            Assert.Equal("a", converter.ConvertToString('a', null, propertyMapData));

            Assert.Equal("True", converter.ConvertToString(true, null, propertyMapData));

            Assert.Equal("", converter.ConvertToString(null, null, propertyMapData));
        }
Exemple #5
0
        public void ConvertToString()
        {
            string result;

            result = converter.ConvertToString(null, CultureInfo.InvariantCulture,
                                               ' ');
            Assert.AreEqual(" ", result, "#1");

            result = converter.ConvertToString(null, CultureInfo.InvariantCulture,
                                               '\0');
            Assert.AreEqual(string.Empty, result, "#2");

            result = converter.ConvertToString(null, CultureInfo.InvariantCulture,
                                               'f');
            Assert.AreEqual("f", result, "#3");

            result = converter.ConvertToString(null, CultureInfo.InvariantCulture,
                                               null);
            Assert.AreEqual(string.Empty, result, "#4");

            result = converter.ConvertToString(null, CultureInfo.InvariantCulture,
                                               new char [] { 'a', 'f' });
            Assert.AreEqual("System.Char[]", result, "#5");
        }