示例#1
0
        public void GetLocationDefault()
        {
            ModelProperties <ModelWithLocationField> modelProperties = new ModelProperties <ModelWithLocationField>();
            ModelWithLocationField model = new ModelWithLocationField {
                Location = null
            };

            Assert.That(modelProperties.GetLocation(null), Is.EqualTo("Enterprise"));
            Assert.That(modelProperties.GetLocation(model), Is.EqualTo("Enterprise"));

            model.Location = "Enterprise.Site.Area";

            Assert.That(modelProperties.GetLocation(model), Is.EqualTo("Enterprise.Site.Area"));
        }
        public void GetLocationWithoutRecurse()
        {
            SimpleModel model = new SimpleModel();
            ModelProperties <SimpleModel> modelProperties = new ModelProperties <SimpleModel>();

            Assert.That(modelProperties.GetLocation(model), Is.EqualTo("Enterprise.Site.Area.Simple"));
        }
        public void GetLocationWithRecurse()
        {
            SimpleModelWithRecurse model = new SimpleModelWithRecurse();
            ModelProperties <SimpleModelWithRecurse> modelProperties = new ModelProperties <SimpleModelWithRecurse>();

            Assert.That(modelProperties.GetLocation(model), Is.EqualTo(null));
        }
        public void TestInheritedModel()
        {
            ModelProperties <InheritedModel> modelProperties = new ModelProperties <InheritedModel>();

            Assert.That(modelProperties.GetLocation(null), Is.EqualTo("Enterprise.Site.Area.Simple"));
            Assert.That(modelProperties.Module, Is.EqualTo(AmplaModules.Production));

            IList <string> properties = modelProperties.GetProperties();

            Assert.That(properties, Contains.Item("Id").And.Contains("Name").And.Contains("Value"));
            Assert.That(properties.Count, Is.EqualTo(3));
        }