public void CreateVirtualEndPoint_NonVirtualID()
        {
            var endPointID = RelationEndPointID.Create(DomainObjectIDs.Order1, typeof(Order), "Customer");

            _endPointFactoryMock.Replay();

            Assert.That(
                () => RelationEndPointFactoryExtensions.CreateVirtualEndPoint(_endPointFactoryMock, endPointID, true),
                Throws.ArgumentException.With.Message.EqualTo("The RelationEndPointID must identify a virtual end-point.\r\nParameter name: endPointID"));
        }
        public void CreateVirtualEndPoint_Many_MarkDataCompleteTrue()
        {
            var endPointID   = RelationEndPointID.Create(DomainObjectIDs.Order1, typeof(Order), "OrderItems");
            var endPointStub = MockRepository.GenerateStub <ICollectionEndPoint> ();

            _endPointFactoryMock
            .Expect(mock => mock.CreateCollectionEndPoint(endPointID))
            .Return(endPointStub);
            _endPointFactoryMock.Replay();

            var result = RelationEndPointFactoryExtensions.CreateVirtualEndPoint(_endPointFactoryMock, endPointID, true);

            _endPointFactoryMock.VerifyAllExpectations();

            Assert.That(result, Is.SameAs(endPointStub));
            endPointStub.AssertWasCalled(stub => stub.MarkDataComplete(Arg <DomainObject[]> .List.Equal(new DomainObject[0])));
        }
        public void CreateVirtualEndPoint_One_MarkDataCompleteTrue()
        {
            var endPointID   = RelationEndPointID.Create(DomainObjectIDs.Order1, typeof(Order), "OrderTicket");
            var endPointStub = MockRepository.GenerateStub <IVirtualObjectEndPoint> ();

            _endPointFactoryMock
            .Expect(mock => mock.CreateVirtualObjectEndPoint(endPointID))
            .Return(endPointStub);
            _endPointFactoryMock.Replay();

            var result = RelationEndPointFactoryExtensions.CreateVirtualEndPoint(_endPointFactoryMock, endPointID, true);

            _endPointFactoryMock.VerifyAllExpectations();

            Assert.That(result, Is.SameAs(endPointStub));
            endPointStub.AssertWasCalled(stub => stub.MarkDataComplete(null));
        }