Ejemplo n.º 1
0
        public void StringConverter()
        {
            var model = new FakeModel()
            {
                StringProperty = "murilo",
                NullableString = null
            };
            var type      = model.GetType();
            var property1 = model.GetType().GetProperty("StringProperty");
            var property2 = model.GetType().GetProperty("NullableString");

            var converter = new StringConverter();

            Assert.IsTrue(converter.Match(property1));
            Assert.IsTrue(converter.Match(property2));

            var info1 = converter.GetValue(model, property1);

            Assert.AreEqual("'murilo'", info1);

            var info2 = converter.GetValue(model, property2);

            Assert.AreEqual("null", info2);
        }