Exemple #1
0
        public void ConvertToString_ValueIsNull_ReturnsEmptyString()
        {
            var converter = new DefaultTypeConverter();

            var memberMapData = new MemberMapData(null)
            {
            };

            var value = converter.ConvertToString(null, null, memberMapData);

            Assert.Equal(string.Empty, value);
        }
Exemple #2
0
        public void ConvertToString_MultipleNullValues_UsesFirstValue()
        {
            var converter = new DefaultTypeConverter();

            var memberMapData = new MemberMapData(null)
            {
                TypeConverterOptions = { NullValues = { "Foo", "Bar" } },
            };

            var value = converter.ConvertToString(null, null, memberMapData);

            Assert.Equal("Foo", value);
        }
        public void ConvertToString_SingleNullValue_UsesValue()
        {
            var converter = new DefaultTypeConverter();

            var memberMapData = new MemberMapData(null)
            {
                TypeConverterOptions = { NullValues = { "Foo" } },
            };

            var value = converter.ConvertToString(null, null, memberMapData);

            Assert.AreEqual("Foo", value);
        }