コード例 #1
0
        public void GetOppositeRelationEndPointIDs()
        {
            var relatedObject1 = DomainObjectMother.CreateFakeObject <Order> ();
            var relatedObject2 = DomainObjectMother.CreateFakeObject <Order> ();
            var collectionData = new DomainObjectCollectionData(new[] { relatedObject1, relatedObject2 });

            _loadStateMock.Stub(stub => stub.GetData(_endPoint)).Return(new ReadOnlyCollectionDataDecorator(collectionData));
            _loadStateMock.Replay();

            var oppositeEndPoints = _endPoint.GetOppositeRelationEndPointIDs().ToArray();

            var expectedOppositeEndPointID1 = RelationEndPointID.Create(relatedObject1.ID, typeof(Order).FullName + ".Customer");
            var expectedOppositeEndPointID2 = RelationEndPointID.Create(relatedObject2.ID, typeof(Order).FullName + ".Customer");

            Assert.That(oppositeEndPoints, Is.EqualTo(new[] { expectedOppositeEndPointID1, expectedOppositeEndPointID2 }));
        }