public void AssignFailTest(string propertyName, object valueToAssign, Type type)
        {
            var testModel = new SimpleValueAssignerRootClass
            {
                Child = new SimpleValueAssignerChildClass()
            };

            var simpleAssigner = new SimpleValueAssigner();

            simpleAssigner.AssignValue(testModel, propertyName, valueToAssign, type);            
        }
示例#2
0
        public void AssignFailTest(string propertyName, object valueToAssign, Type type)
        {
            var testModel = new SimpleValueAssignerRootClass
            {
                Child = new SimpleValueAssignerChildClass()
            };

            var simpleAssigner = new SimpleValueAssigner();

            simpleAssigner.AssignValue(testModel, propertyName, valueToAssign, type);
        }
        public void AssignSuccessTest()
        {
            var testModel = new SimpleValueAssignerRootClass { 
                Child = new SimpleValueAssignerChildClass()
            };

            var simpleAssigner = new SimpleValueAssigner();

            simpleAssigner.AssignValue(testModel, "RootName", "test root name", typeof(string));
            simpleAssigner.AssignValue(testModel, "RootValue", 123, typeof(int));

            simpleAssigner.AssignValue(testModel, "Child.ChildName", "test child name", typeof(string));
            simpleAssigner.AssignValue(testModel, "Child.ChildValue", 321, typeof(int));

            Assert.AreEqual("test root name", testModel.RootName);
            Assert.AreEqual(123, testModel.RootValue);
            Assert.AreEqual("test child name", testModel.Child.ChildName);
            Assert.AreEqual(321, testModel.Child.ChildValue);
        }
示例#4
0
        public void AssignSuccessTest()
        {
            var testModel = new SimpleValueAssignerRootClass {
                Child = new SimpleValueAssignerChildClass()
            };

            var simpleAssigner = new SimpleValueAssigner();

            simpleAssigner.AssignValue(testModel, "RootName", "test root name", typeof(string));
            simpleAssigner.AssignValue(testModel, "RootValue", 123, typeof(int));

            simpleAssigner.AssignValue(testModel, "Child.ChildName", "test child name", typeof(string));
            simpleAssigner.AssignValue(testModel, "Child.ChildValue", 321, typeof(int));

            Assert.AreEqual("test root name", testModel.RootName);
            Assert.AreEqual(123, testModel.RootValue);
            Assert.AreEqual("test child name", testModel.Child.ChildName);
            Assert.AreEqual(321, testModel.Child.ChildValue);
        }