Ejemplo n.º 1
0
        public void IsDefaultValue()
        {
            SimpleModel model = new SimpleModel();
            ModelProperties <SimpleModel> modelProperties = new ModelProperties <SimpleModel>();

            Assert.That(modelProperties.IsDefaultValue(model, "Id"), Is.True, "Id");
            Assert.That(modelProperties.IsDefaultValue(model, "Value"), Is.True, "Value");
            model.Id = 100;
            Assert.That(modelProperties.IsDefaultValue(model, "Id"), Is.False, "Id");
            model.Value = 12.34;
            Assert.That(modelProperties.IsDefaultValue(model, "Value"), Is.False, "Value");
        }
Ejemplo n.º 2
0
        public void GetPropertiesReturnsLocationField()
        {
            ModelProperties <ModelWithLocationField> modelProperties = new ModelProperties <ModelWithLocationField>();
            ModelWithLocationField model = new ModelWithLocationField();

            var properties = modelProperties.GetProperties();

            Assert.That(properties.Count, Is.EqualTo(1));
            Assert.That(properties[0], Is.EqualTo("Location"));

            Assert.That(modelProperties.IsDefaultValue(model, "Location"), Is.True);

            model.Location = "Enterprise.Site";
            Assert.That(modelProperties.IsDefaultValue(model, "Location"), Is.False);
        }