예제 #1
0
        public ModelWithReadOnly CreateModel()
        {
            var model = new ModelWithReadOnly(96, "field2 string");

            model.ChangeField("field1 string");
            model.Dictionary.Add(14, "14");
            model.Dictionary.Add(11, "11");
            return(model);
        }
예제 #2
0
        private void ValidateModel(ModelWithReadOnly model)
        {
            Assert.Equal(96, model.GetId());
            Assert.Equal("field1 string", model.Field1);
            Assert.Equal("field2 string", model.Field2);
            Assert.Equal("field1 stringfield2 string", model.Field3);

            Assert.Equal("14", model.Dictionary[14]);
            Assert.Equal("11", model.Dictionary[11]);
        }
예제 #3
0
        public void TestReadOnlyProperties()
        {
            ModelWithReadOnly model = new ModelWithReadOnly();

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

            Assert.That(modelProperties.GetProperties().Count, Is.EqualTo(4));

            model.Name = "name1";
            AssertPropertyGetValue(modelProperties, model, "ReadOnlyName", "name1");
            AssertPropertyNotSetValue(modelProperties, model, "ReadOnlyName", "invalid name");
        }