public void TestCreateRelationship() { ISingleRelationship rel = (ISingleRelationship)mRelationshipDef.CreateRelationship(mMockBo, mMockBo.PropCol); Assert.AreEqual(mRelationshipDef.RelationshipName, rel.RelationshipName); Assert.IsTrue(mMockBo.GetPropertyValue("MockBOProp1") == null); Assert.IsFalse(rel.HasRelatedObject(), "Should be false since props are not defaulted in Mock bo"); mMockBo.SetPropertyValue("MockBOProp1", mMockBo.GetPropertyValue("MockBOID")); mMockBo.Save(); Assert.IsTrue(rel.HasRelatedObject(), "Should be true since prop MockBOProp1 has been set"); Assert.AreEqual(mMockBo.GetPropertyValue("MockBOProp1"), mMockBo.GetPropertyValue("MockBOID")); MockBO ltempBO = (MockBO)rel.GetRelatedObject(); Assert.IsFalse(ltempBO == null); Assert.AreEqual (mMockBo.GetPropertyValue("MockBOID"), ltempBO.GetPropertyValue("MockBOID"), "The object returned should be the one with the ID = MockBOID"); Assert.AreEqual (mMockBo.GetPropertyValueString("MockBOProp1"), ltempBO.GetPropertyValueString("MockBOID"), "The object returned should be the one with the ID = MockBOID"); Assert.AreEqual (mMockBo.GetPropertyValue("MockBOProp1"), ltempBO.GetPropertyValue("MockBOID"), "The object returned should be the one with the ID = MockBOID"); mMockBo.MarkForDelete(); mMockBo.Save(); }
public void TestCreateRelationship() { IMultipleRelationship rel = (IMultipleRelationship)_multipleRelationshipDef.CreateRelationship(_fakeBO, _fakeBO.PropCol); Assert.AreEqual(_multipleRelationshipDef.RelationshipName, rel.RelationshipName); Assert.IsTrue(_fakeBO.GetPropertyValue("MockBOProp1") == null); Assert.AreEqual(0, rel.BusinessObjectCollection.Count); }
public void TestCreateRelationship() { MultipleRelationship rel = (MultipleRelationship)_multipleRelationshipDef.CreateRelationship(_mockBo, _mockBo.PropCol); Assert.AreEqual(_multipleRelationshipDef.RelationshipName, rel.RelationshipName); Assert.IsTrue(_mockBo.GetPropertyValue("MockBOProp1") == null); Assert.IsTrue(rel.GetRelatedBusinessObjectCol().Count == 0); // _mockBo.SetPropertyValue("MockBOProp1",_mockBo.GetPropertyValue("MockBOID")); // _mockBo.Save(); // Assert.IsTrue (rel.HasRelationship(), "Should be true since prop MockBOProp1 has been set"); // // Assert.AreEqual(_mockBo.GetPropertyValue("MockBOProp1") ,_mockBo.GetPropertyValue("MockBOID")); //TODO: // MockBO ltempBO = (MockBO) rel.GetRelatedObject(); // Assert.IsFalse(ltempBO == null); // Assert.AreEqual(_mockBo.GetPropertyValue("MockBOID") ,ltempBO.GetPropertyValue("MockBOID"), "The object returned should be the one with the ID = MockBOID"); // Assert.AreEqual(_mockBo.GetPropertyValueString("MockBOProp1") ,ltempBO.GetPropertyValueString("MockBOID"), "The object returned should be the one with the ID = MockBOID"); // Assert.AreEqual(_mockBo.GetPropertyValue("MockBOProp1") ,ltempBO.GetPropertyValue("MockBOID"), "The object returned should be the one with the ID = MockBOID"); }