当前位置: 首页>>代码示例>>C#>>正文


C# PropDef.CreateBOProp方法代码示例

本文整理汇总了C#中PropDef.CreateBOProp方法的典型用法代码示例。如果您正苦于以下问题:C# PropDef.CreateBOProp方法的具体用法?C# PropDef.CreateBOProp怎么用?C# PropDef.CreateBOProp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PropDef的用法示例。


在下文中一共展示了PropDef.CreateBOProp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Setup

        public void Setup()
        {
            ClassDef.ClassDefs.Clear();
        	_boPropCol1 = new BOPropCol();
        	_keyDef1 = new KeyDef();
        	_boPropCol2 = new BOPropCol();
        	_keyDef2 = new KeyDef();

            //Props for KeyDef 1
            PropDef lPropDef = new PropDef("PropName", typeof(string), PropReadWriteRule.ReadWrite, null);
            _boPropCol1.Add(lPropDef.CreateBOProp(false));
            _keyDef1.Add(lPropDef);

            lPropDef = new PropDef("PropName1", typeof(string), PropReadWriteRule.ReadWrite, null);
            _boPropCol1.Add(lPropDef.CreateBOProp(false));
            _keyDef1.Add(lPropDef);

            //Props for KeyDef 2
            lPropDef = new PropDef("PropName1", typeof(string), PropReadWriteRule.ReadWrite, null);
            _boPropCol2.Add(lPropDef.CreateBOProp(false));
            _keyDef2.Add(lPropDef);

            lPropDef = new PropDef("PropName", typeof(string), PropReadWriteRule.ReadWrite, null);
            _boPropCol2.Add(lPropDef.CreateBOProp(false));
            _keyDef2.Add(lPropDef);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:26,代码来源:TestBoKey.cs

示例2: Test_ValidateProp_WhenPropNotValid_IsValidFalse

 public void Test_ValidateProp_WhenPropNotValid_IsValidFalse()
 {
     //---------------Set up test pack-------------------
     //Test compulsory with no default set
     PropDef lPropDefWithRules = new PropDef("PropNameWithRules", "System", "String",
                                             PropReadWriteRule.ReadWrite, null, null, true, false);
     lPropDefWithRules.AddPropRule(new PropRuleString(lPropDefWithRules.PropertyName, "", -1, -1, null));
     IBOProp lBOProp = lPropDefWithRules.CreateBOProp(true);
     //---------------Assert Precondition----------------
     Assert.IsTrue(lBOProp.IsValid);
     Assert.AreEqual("", lBOProp.InvalidReason);
     //---------------Execute Test ----------------------
     lBOProp.Validate();
     //---------------Test Result -----------------------
     Assert.IsFalse(lBOProp.IsValid);
     StringAssert.Contains("'Prop Name With Rules' is a compulsory field and has no value.", lBOProp.InvalidReason);
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:17,代码来源:TestBoProp.cs

示例3: init

        public void init()
        {
            mBOPropCol = new BOPropCol();
            mPropDef = new PropDef("PropName", typeof(string), PropReadWriteRule.ReadWrite, null);
            mBOPropCol.Add(mPropDef.CreateBOProp(false));

            mPropDef = new PropDef("Prop2", typeof(string), PropReadWriteRule.ReadWrite, null);
            mPropDef.AddPropRule(new PropRuleString(mPropDef.PropertyName, "Test Message", 1, 10, null));
            mBOPropCol.Add(mPropDef.CreateBOProp(false));

            BOPropCol anotherPropCol = new BOPropCol();
            PropDef anotherPropDef =
                new PropDef("TestAddPropCol", typeof(string), PropReadWriteRule.ReadWrite, null);
            anotherPropCol.Add(anotherPropDef.CreateBOProp(false));

            mBOPropCol.Add(anotherPropCol);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:17,代码来源:TestBoPropCol.cs

示例4: Test_RestoreValidPropToInvalidState

 public void Test_RestoreValidPropToInvalidState()
 {
     //---------------Set up test pack-------------------
                 //Test compulsory with no default set
     PropDef lPropDefWithRules = new PropDef("PropNameWithRules", "System", "String",
                                             PropReadWriteRule.ReadWrite, null, null, true, false);
     lPropDefWithRules.AddPropRule(new PropRuleString(lPropDefWithRules.PropertyName, "", -1, -1, null));
     IBOProp lBOProp = lPropDefWithRules.CreateBOProp(true);
     //Do validate
     lBOProp.Validate(); 
     lBOProp.Value = "New Value";
     //---------------Assert Precondition----------------
     Assert.IsTrue(lBOProp.IsValid);
     Assert.IsFalse(lBOProp.InvalidReason.Length > 0);
     //---------------Execute Test ----------------------
     lBOProp.RestorePropValue();
     //---------------Test Result -----------------------
     Assert.IsFalse(lBOProp.IsValid);
     Assert.IsTrue(lBOProp.InvalidReason.Length > 0);
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:20,代码来源:TestBoProp.cs

示例5: typeof

 public void Test_ConstructProp_ForCustomTypeWithATypeConverter_WithDefaultValueString_ShouldConstructWithCorrectValue()
 {
     //---------------Set up test pack-------------------
     const string expectedValue = "[email protected]";
     var type = typeof(EmailAddressWithTypeConverter);
     var propDef = new PropDef("Name", type.Assembly.FullName, type.Name, PropReadWriteRule.ReadWrite, "DD", expectedValue, false, false);
     //---------------Assert Precondition----------------
     Assert.IsInstanceOf<EmailAddressWithTypeConverter>(propDef.DefaultValue);
     Assert.AreEqual(expectedValue, propDef.DefaultValue.ToString());
     Assert.AreEqual(expectedValue, propDef.DefaultValueString);
     //---------------Execute Test ----------------------
     var prop = propDef.CreateBOProp(true);
     //---------------Test Result -----------------------
     Assert.IsInstanceOf<EmailAddressWithTypeConverter>(prop.Value);
     Assert.AreEqual(expectedValue, prop.Value.ToString());
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:16,代码来源:TestBoProp.cs

示例6: TestCreateBOProp_CorrectPropCreated

        public void TestCreateBOProp_CorrectPropCreated()
        {            
            //---------------Set up test pack-------------------
            PropDef propDef = new PropDef("PropName", typeof(int), PropReadWriteRule.ReadWrite, null);

            //-----Test PreCondition--------------------------
            Assert.IsFalse(propDef.HasLookupList());

            //---------------Execute Test ----------------------

            IBOProp prop = propDef.CreateBOProp(false);
            //---------------Test Result -----------------------

            Assert.IsInstanceOf(typeof(BOProp), prop);

        }
开发者ID:Chillisoft,项目名称:habanero,代码行数:16,代码来源:TestPropDef.cs

示例7: TestUpdateProp_WriteNew_Existing

 public void TestUpdateProp_WriteNew_Existing()
 {
     //---------------Set up test pack-------------------
     PropDef propDef = new PropDef("TestProp", "System", "String",
                                   PropReadWriteRule.WriteNew, null, null, true, false);
     IBOProp boProp = propDef.CreateBOProp(false);
     //---------------Assert preconditions---------------
     Assert.AreEqual(null, boProp.Value, "BOProp value should start being null");
     //---------------Execute Test ----------------------
     try
     {
         boProp.Value = "TestValue";
         Assert.Fail("Expected to throw an BOPropWriteException");
     }
         //---------------Test Result -----------------------
     catch (BOPropWriteException ex)
     {
         StringAssert.Contains("is not editable since it is set up as WriteNew and the object is not new", ex.Message);
     }
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:20,代码来源:TestBoProp.cs

示例8: TestBoPropWithEnumCreate

 public void TestBoPropWithEnumCreate()
 {
     PropDef propDef = new PropDef("EnumProp", typeof(ContactPersonTestBO.ContactType), PropReadWriteRule.ReadWrite, ContactPersonTestBO.ContactType.Family);
     //Create the property for a new object (default will be set)
     IBOProp boProp;
     boProp = propDef.CreateBOProp(true);
     Assert.AreEqual(ContactPersonTestBO.ContactType.Family, boProp.Value);
     Assert.AreEqual("Family", boProp.PropertyValueString);
     //Create the property for anexisting object (default will not be set)
     boProp = propDef.CreateBOProp(false);
     Assert.AreEqual(null, boProp.Value);
     Assert.AreEqual("", boProp.PropertyValueString);
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:13,代码来源:TestBoProp.cs

示例9: TestDisplayNameSetAfterCompulsoryInitialisation

        public void TestDisplayNameSetAfterCompulsoryInitialisation()
        {
            PropDef propDef = new PropDef("TestProp", "System", "String",
                                  PropReadWriteRule.ReadWrite, null, null, true, false);
            IBOProp boProp = propDef.CreateBOProp(true);
            boProp.Validate();
            Assert.IsFalse(boProp.InvalidReason.Contains("'TestProp'"));
            Assert.IsTrue(boProp.InvalidReason.Contains("'Test Prop'"));
            Assert.IsFalse(boProp.InvalidReason.Contains("'Test Property'"));

            Assert.IsFalse(boProp.InvalidReason.Contains("'TestProp'"));
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:12,代码来源:TestBoProp.cs

示例10: CreateBOObjectID

        private static BOObjectID CreateBOObjectID()
        {
            PropDef propDef1 = new PropDef("PropName1", typeof(Guid), PropReadWriteRule.ReadWrite, null);
            BOPropCol propCol = new BOPropCol();

            propCol.Add(propDef1.CreateBOProp(false));
            PrimaryKeyDef keyDef = new PrimaryKeyDef();
            keyDef.IsGuidObjectID = true;
            keyDef.Add(propDef1);
            return (BOObjectID)keyDef.CreateBOKey(propCol);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:11,代码来源:TestBOObjectID.cs

示例11: CreateBOKeyGuidAndString

 private static IBOKey CreateBOKeyGuidAndString()
 {
     PropDef propDef1 = new PropDef("PropName1", typeof(Guid), PropReadWriteRule.ReadWrite, null)
                            {ClassDef = ContactPersonTestBO.LoadDefaultClassDef()};
     PropDef propDef2 = new PropDef("PropName2", typeof(string), PropReadWriteRule.ReadWrite, null)
                            {ClassDef = propDef1.ClassDef};
     BOPropCol propCol = new BOPropCol();
     propCol.Add( propDef1.CreateBOProp(false));
     propCol.Add(propDef2.CreateBOProp(false));
     KeyDef keyDef = new KeyDef {propDef1, propDef2};
     return keyDef.CreateBOKey(propCol);
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:12,代码来源:TestBoKey.cs

示例12: TestUpdatedEvent

        public void TestUpdatedEvent()
        {
            PropDef propDef1 = new PropDef("PropName1", typeof(string), PropReadWriteRule.ReadWrite, null);
            PropDef propDef2 = new PropDef("PropName2", typeof(string), PropReadWriteRule.ReadWrite, null);

            BOPropCol propCol = new BOPropCol();
            propCol.Add(propDef1.CreateBOProp(false));
            propCol.Add(propDef2.CreateBOProp(false));

            KeyDef keyDef = new KeyDef {propDef1, propDef2};
            IBOKey boKey = keyDef.CreateBOKey(propCol);

            boKey.Updated += UpdatedEventHandler;
            propCol["PropName1"].Value = "new value";
            Assert.IsTrue(_updatedEventHandled);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:16,代码来源:TestBoKey.cs

示例13: TestIntegerIndexer

        public void TestIntegerIndexer()
        {
            PropDef propDef1 = new PropDef("PropName1", typeof(string), PropReadWriteRule.ReadOnly, null);
            PropDef propDef2 = new PropDef("PropName2", typeof(string), PropReadWriteRule.ReadOnly, null);
            
            BOPropCol propCol = new BOPropCol();
            propCol.Add(propDef1.CreateBOProp(false));
            propCol.Add(propDef2.CreateBOProp(false));
            
            KeyDef keyDef = new KeyDef();
            keyDef.Add(propDef1);
            keyDef.Add(propDef2);
            IBOKey boKey = keyDef.CreateBOKey(propCol);

            Assert.AreEqual(propCol["PropName1"], boKey[0]);
            Assert.AreEqual(propCol["PropName2"], boKey[1]);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:17,代码来源:TestBoKey.cs

示例14: TestEquality

        public void TestEquality()
        {
            BOKey boKey = (BOKey) _keyDef1.CreateBOKey(_boPropCol1);

            // Test when property count is different
            KeyDef keyDef = new KeyDef();
            BOKey otherKey = new BOKey(keyDef);
            Assert.IsFalse(boKey == otherKey);

            // Same property count, but different prop names
            PropDef propDef1 = new PropDef("PropName5", typeof(string), PropReadWriteRule.ReadOnly, null);
            PropDef propDef2 = new PropDef("PropName6", typeof(string), PropReadWriteRule.ReadOnly, null);
            BOPropCol propCol = new BOPropCol();
            propCol.Add(propDef1.CreateBOProp(false));
            propCol.Add(propDef2.CreateBOProp(false));
            keyDef.Add(propDef1);
            keyDef.Add(propDef2);
            otherKey = (BOKey) keyDef.CreateBOKey(propCol);
            Assert.IsFalse(boKey == otherKey);

            // Same props but different values (with one null)
            otherKey = (BOKey) _keyDef1.CreateBOKey(_boPropCol2);
            otherKey["PropName"].Value = "blah";
            Assert.IsFalse(boKey == otherKey);

            // Same props but different values (neither are null)
            otherKey = (BOKey) _keyDef1.CreateBOKey(_boPropCol2);
            boKey["PropName"].Value = "diblah";
            Assert.IsFalse(boKey == otherKey);
            Assert.IsFalse(boKey.Equals(otherKey));

            // False when different type of object
            Assert.IsFalse(boKey.Equals(keyDef));

            // Finally, when they are equal
            boKey["PropName"].Value = "blah";
            Assert.IsTrue(boKey == otherKey);
            Assert.IsTrue(boKey.Equals(otherKey));
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:39,代码来源:TestBoKey.cs

示例15: TestFromIRelationship_MultipleProps

        public void TestFromIRelationship_MultipleProps()
        {
            //---------------Set up test pack-------------------
            MyBO.LoadDefaultClassDef();
            RelKeyDef relKeyDef = new RelKeyDef();
            const string propValue1 = "bob1";
            PropDef boPropDef1 = new PropDef("Prop1", typeof(String), PropReadWriteRule.ReadWrite, propValue1);
            relKeyDef.Add(new RelPropDef(boPropDef1, "RelatedProp1"));
            const string propValue2 = "bob2";
            PropDef boPropDef2 = new PropDef("Prop2", typeof(String), PropReadWriteRule.ReadWrite, propValue2);
            relKeyDef.Add(new RelPropDef(boPropDef2, "RelatedProp2"));
            RelationshipDef reldef =
                new MultipleRelationshipDef("bob", "Habanero.Test", "MyBO", relKeyDef, false, "", DeleteParentAction.DoNothing);
            ContactPersonTestBO.LoadDefaultClassDef();
            ContactPersonTestBO cp = new ContactPersonTestBO();
            BOPropCol col = new BOPropCol();
            col.Add(boPropDef1.CreateBOProp(true));
            col.Add(boPropDef2.CreateBOProp(true));
            IRelationship relationship = reldef.CreateRelationship(cp, col);
            //---------------Assert PreConditions---------------            
            //---------------Execute Test ----------------------
            Criteria criteria = Criteria.FromRelationship(relationship);
            //---------------Test Result -----------------------
            string expectedString = string.Format("(RelatedProp1 = '{0}') AND (RelatedProp2 = '{1}')", propValue1, propValue2);
            StringAssert.AreEqualIgnoringCase(expectedString, criteria.ToString());

            //---------------Tear Down -------------------------          
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:28,代码来源:TestCriteria.cs


注:本文中的PropDef.CreateBOProp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。