Beispiel #1
0
        public void CloneModel()
        {
            SimpleModel model = new SimpleModel();

            CalendarProperties <SimpleModel> modelProperties = new CalendarProperties <SimpleModel>();

            SimpleModel clone = modelProperties.CloneModel(model);

            Assert.That(ReferenceEquals(model, clone), Is.False);

            AssertPropertyGetValue(modelProperties, model, "Id", "0");
            AssertPropertyGetValue(modelProperties, model, "Name", null);
            AssertPropertyGetValue(modelProperties, model, "Value", "0");

            AssertPropertyGetValue(modelProperties, clone, "Id", "0");
            AssertPropertyGetValue(modelProperties, clone, "Name", null);
            AssertPropertyGetValue(modelProperties, clone, "Value", "0");

            model.Id++;

            Assert.That(clone.Id, Is.Not.EqualTo(model.Id));
        }
Beispiel #2
0
        public void CloneModelWithValues()
        {
            SimpleModel model = new SimpleModel {
                Id = 100, Name = "Ampla", Value = 1.234
            };

            CalendarProperties <SimpleModel> modelProperties = new CalendarProperties <SimpleModel>();

            SimpleModel clone = modelProperties.CloneModel(model);

            Assert.That(ReferenceEquals(model, clone), Is.False);

            AssertPropertyGetValue(modelProperties, model, "Id", "100");
            AssertPropertyGetValue(modelProperties, model, "Name", "Ampla");
            AssertPropertyGetValue(modelProperties, model, "Value", "1.234");

            AssertPropertyGetValue(modelProperties, clone, "Id", "100");
            AssertPropertyGetValue(modelProperties, clone, "Name", "Ampla");
            AssertPropertyGetValue(modelProperties, clone, "Value", "1.234");

            model.Id++;

            Assert.That(clone.Id, Is.Not.EqualTo(model.Id));
        }