コード例 #1
0
        public void Test_CreateValidBusinessObject_ShouldReturnBOWithCompulsoryPropsPopulated()
        {
            //---------------Set up test pack-------------------
            //---------------Assert Precondition----------------
            var factory = new BOTestFactory(typeof(FakeBO));
            //---------------Execute Test ----------------------
            var businessObject = factory.CreateValidBusinessObject() as FakeBO;

            //---------------Test Result -----------------------
            Assert.IsNotNull(businessObject);
            Assert.IsInstanceOf <FakeBO>(businessObject);
            Assert.IsNotNull(businessObject.CompulsoryString);
        }
コード例 #2
0
        public void Test_SetDefaultValue_WhenRelationship_ShouldCreateWithValueSet()
        {
            //---------------Set up test pack-------------------
            var relatedBO        = new RelatedFakeBo();
            var boWithRelFactory = new BOTestFactory(typeof(FakeBOWithRelationship));

            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            boWithRelFactory.SetValueFor("SingleRelationship", relatedBO);
            var boWithRelationship = boWithRelFactory.CreateValidBusinessObject() as FakeBOWithRelationship;

            //---------------Test Result -----------------------
            Assert.IsNotNull(boWithRelationship);
            Assert.AreSame(relatedBO, boWithRelationship.SingleRelationship);
        }
コード例 #3
0
        public void Test_GetValidRelationshipValue_ShouldCreateRelatedBO()
        {
            //---------------Set up test pack-------------------
            var boTestFactory  = new BOTestFactory(typeof(FakeBO));
            var businessObject = (FakeBO)boTestFactory.CreateValidBusinessObject();
            var relationship   = businessObject.Relationships["NonCompulsoryRelationship"] as ISingleRelationship;

            //---------------Assert Precondition----------------
            Assert.IsNotNull(relationship);
            Assert.IsNull(relationship.GetRelatedObject());
            //---------------Execute Test ----------------------
            IRelationshipDef relationshipDef        = relationship.RelationshipDef;
            IBusinessObject  validRelationshipValue = boTestFactory.GetValidRelationshipValue(relationshipDef as ISingleValueDef);

            //---------------Test Result -----------------------
            Assert.IsNotNull(validRelationshipValue);
            Assert.IsTrue(validRelationshipValue.Status.IsNew);
        }