Esempio n. 1
0
        public void ResolveValueWithNullValue()
        {
            ValidatedModelFieldMapping fieldMapping = new ValidatedModelFieldMapping("Location", s => !string.IsNullOrEmpty(s));

            Model model = new Model();

            ModelProperties <Model> modelProperties = new ModelProperties <Model>();

            string value;

            Assert.That(fieldMapping.TryResolveValue(modelProperties, model, out value), Is.False);
            Assert.That(value, Is.Null);
        }
Esempio n. 2
0
        public void ResolveValueWithValue()
        {
            ValidatedModelFieldMapping fieldMapping = new ValidatedModelFieldMapping("Location", s => !string.IsNullOrEmpty(s));

            Model model = new Model {
                Location = "Plant.Area.Point"
            };

            ModelProperties <Model> modelProperties = new ModelProperties <Model>();

            string value;

            Assert.That(fieldMapping.TryResolveValue(modelProperties, model, out value), Is.True);
            Assert.That(value, Is.EqualTo("Plant.Area.Point"));
        }