Esempio n. 1
0
        public void SetParametersFromObject_StructuredGood_Null_Test()
        {
            DbAutoFillHelper.AddParametersFromObjectMembers(_command, _dvco);

            Assert.AreEqual(_command.Parameters.Count, 1);
            Assert.IsTrue(((INullable)_command.Parameters[OBJECT_MYSTRUCTUREDFIELD_NAME].SqlValue).IsNull);
        }
Esempio n. 2
0
        public void SetParametersFromObject_GoodValues_Test()
        {
            DbAutoFillHelper.AddParametersFromObjectMembers(_command, _dvco);

            Assert.AreEqual(_command.Parameters[DEFAULT_PARAMETER1_NAME].Value, DEFAULT_PARAMETER_1_VALUE);
            Assert.AreEqual(_command.Parameters[DEFAULT_PARAMETER2_NAME].Value, DEFAULT_PARAMETER_2_VALUE);
            Assert.AreEqual(_command.Parameters[DEFAULT_ToDB_PARAMETER_NAME].Value, DEFAULT_ToDBPARAMETER_VALUE);
        }
Esempio n. 3
0
        public void Advanced_SetParametersFromObject_ParametersSuffix_OnClass_Test()
        {
            ClassWithSuffix cws = new ClassWithSuffix();

            DbAutoFillHelper.AddParametersFromObjectMembers(_command, cws);

            Assert.IsTrue(_command.Parameters.Contains(ADVANCED_PARAMETER_SUFFIX_PARAM_NAME));
        }
Esempio n. 4
0
        public void Advanced_SetParametersFromObject_ParametersSuffix_OnProperty_Test()
        {
            AdvancedAutoFillClass aafc = new AdvancedAutoFillClass();

            DbAutoFillHelper.AddParametersFromObjectMembers(_command, aafc);

            Assert.IsTrue(_command.Parameters.Contains(ADVANCED_PARAMETER_SUFFIX_PARAM_NAME));
        }
Esempio n. 5
0
        public void Basic_SetParametersFromObject_PlainField_Test()
        {
            SecondObject so = new SecondObject();

            DbAutoFillHelper.AddParametersFromObjectMembers(_command, so);

            Assert.IsTrue(_command.Parameters.Contains(BASIC_PARAMETER_SECOND_OBJECT_NORMAL_FIELD));
            Assert.IsTrue(_command.Parameters[BASIC_PARAMETER_SECOND_OBJECT_NORMAL_FIELD].Value.Equals(BASIC_PARAMETER_SECOND_OBJECT_NORMAL_FIELD_VALUE));
        }
Esempio n. 6
0
        public void SetParametersFromObject_GoodParameters_Test()
        {
            DbAutoFillHelper.AddParametersFromObjectMembers(_command, _dvco);

            Assert.IsTrue(_command.Parameters.Contains(DEFAULT_PARAMETER1_NAME));
            Assert.IsTrue(_command.Parameters.Contains(DEFAULT_PARAMETER2_NAME));
            Assert.IsFalse(_command.Parameters.Contains(DEFAULT_HIDDEN_PARAMETER_NAME));
            Assert.IsTrue(_command.Parameters.Contains(DEFAULT_ToDB_PARAMETER_NAME));
            Assert.IsFalse(_command.Parameters.Contains(DEFAULT_NONE_PARAMETER_NAME));
            Assert.IsFalse(_command.Parameters.Contains(DEFAULT_FROMDB_PARAMETER_NAME));
        }
Esempio n. 7
0
        public void Advanced_SetParametersFromObject_GoodParameters_Test()
        {
            AdvancedAutoFillClass aafc = new AdvancedAutoFillClass();

            DbAutoFillHelper.AddParametersFromObjectMembers(_command, aafc);

            Assert.IsTrue(_command.Parameters.Count > 0);
            Assert.IsTrue(_command.Parameters.Contains(ADVANCED_PARAMETER_ALIASED_PARAM_NAME));
            Assert.IsTrue(_command.Parameters.Contains(ADVANCED_PARAMETER_ALLOWED_MISSING_PARAM_NAME));
            Assert.IsTrue(_command.Parameters.Contains(ADVANCED_PARAMETER_DbTypeDTDefault_PARAM_NAME));
            Assert.IsTrue(_command.Parameters.Contains(ADVANCED_PARAMETER_DbTypeDT_PARAM_NAME));
            Assert.IsTrue(_command.Parameters.Contains(ADVANCED_PARAMETER_PREFIX_OVERRIDE_PARAM_NAME));
        }
Esempio n. 8
0
        public void SetParametersFromObject_StructuredGood_NotNull_Test()
        {
            _dvco.MyStructuredField = new GenericSqlStructuredType();
            _dvco.MyStructuredField.Add(new MyGenericObject()
            {
                id = OBJECT_SET_ELEMENT1_ID, name = OBJECT_SET_ELEMENT1_NAME
            });
            _dvco.MyStructuredField.Add(new MyGenericObject()
            {
                id = OBJECT_SET_ELEMENT2_ID, name = OBJECT_SET_ELEMENT2_NAME
            });
            DbAutoFillHelper.AddParametersFromObjectMembers(_command, _dvco);

            Assert.IsTrue(_command.Parameters.Contains(OBJECT_MYSTRUCTUREDFIELD_NAME));
            Assert.IsTrue(_command.Parameters[OBJECT_MYSTRUCTUREDFIELD_NAME].SqlDbType == SqlDbType.Structured);
        }