示例#1
0
        public void TestTestModelToOnce()
        {
            // Arrange
            var testModel = CreateLoadedTestModel();
            var onceModel = new OnceModel {
                String = "Came From Behind"
            };

            // Act
            ModelMerge.MergeProperties(testModel, onceModel, MergeMode.All);

            // Assert
            Assert.IsTrue(testModel.String.Equals(onceModel.String));
        }
示例#2
0
        public void TestModelMergeAll()
        {
            // Arrange
            TestModel newValuesModel, model;

            InitializeModelsForMerge(out newValuesModel, out model);

            // Act
            ModelMerge.MergeProperties(model, newValuesModel);

            // Assert
            Assert.IsTrue(newValuesModel.Integer.Equals(model.Integer));
            Assert.IsTrue(newValuesModel.Decimal.Equals(model.Decimal));
            Assert.IsTrue(newValuesModel.Float.Equals(model.Float));
            Assert.IsTrue(newValuesModel.String.Equals(model.String));
            Assert.IsTrue(newValuesModel.Object.Equals(model.Object));
        }
示例#3
0
        public void TestModelMergeOnce()
        {
            // Arrange
            var firstValue  = "Hello";
            var secondValue = "World";

            var model = new OnceModel {
                String = null
            };
            var newValues1 = new OnceModel {
                String = firstValue
            };
            var newValues2 = new OnceModel {
                String = secondValue
            };

            // Act
            ModelMerge.MergeProperties(model, newValues1, MergeMode.Update);
            ModelMerge.MergeProperties(model, newValues2, MergeMode.Update);

            // Assert
            Assert.IsTrue(model.String.Equals(newValues1.String));
        }