public void InvalidSetValidationRulesOnProperties() { EditableGetSetRuleValidation egsv = EditableGetSetRuleValidation.NewEditableGetSetValidation(); try { // Set the required property and verify that it has the value that it was set to. egsv.MemberBackedIdWithNoRelationshipTypes = ID; Assert.Fail("This property has a backing feild and an exception should of been thrown."); } catch (Exception ex) { Assert.IsTrue(true, ex.Message); } }
public void InvalidGetValidationRulesOnProperties() { IDataPortal <EditableGetSetRuleValidation> dataPortal = _testDIContext.CreateDataPortal <EditableGetSetRuleValidation>(); EditableGetSetRuleValidation egsv = EditableGetSetRuleValidation.NewEditableGetSetValidation(dataPortal); try { // get the required property and verify that it has the value that it was set to. var result = egsv.MemberBackedIdWithNoRelationshipTypes; Assert.Fail("This property has a backing feild and an exception should of been thrown."); } catch (Exception ex) { Assert.IsTrue(true, ex.Message); } }
public void CheckValidationRulesOnProperties() { IDataPortal <EditableGetSetRuleValidation> dataPortal = _testDIContext.CreateDataPortal <EditableGetSetRuleValidation>(); EditableGetSetRuleValidation egsv = EditableGetSetRuleValidation.NewEditableGetSetValidation(dataPortal); // Verify that the id properties are not set. Assert.IsTrue(egsv.Id.Equals(string.Empty)); Assert.IsTrue(egsv.MemberBackedId.Equals(string.Empty)); try { Assert.IsTrue(egsv.MemberBackedIdWithNoRelationshipTypes.Equals(string.Empty)); Assert.Fail("This property has a backing feild and an exception should of been thrown."); } catch (Exception ex) { Assert.IsTrue(true, ex.Message); } // Verify that the object is not valid. Assert.IsFalse(egsv.IsValid, egsv.BrokenRulesCollection.ToString()); // Set the required property and verify that it has the value that it was set to. egsv.Id = ID; Assert.IsTrue(ID.Equals(egsv.Id)); // Set the required property and verify that it has the value that it was set to. egsv.MemberBackedId = ID; Assert.IsTrue(ID.Equals(egsv.MemberBackedId)); try { // Set the required property and verify that it has the value that it was set to. egsv.MemberBackedIdWithNoRelationshipTypes = ID; Assert.IsTrue(ID.Equals(egsv.MemberBackedIdWithNoRelationshipTypes)); } catch (Exception ex) { Assert.IsTrue(true, ex.Message); } // Verify that the object is not valid. Assert.IsFalse(egsv.IsValid, egsv.BrokenRulesCollection.ToString()); }