Ejemplo n.º 1
0
        public override void SetUp()
        {
            base.SetUp();

            _virtualEndPointMock = MockRepository.GenerateStrictMock <IVirtualEndPoint <object> >();
            _endPointLoaderMock  = MockRepository.GenerateStrictMock <TestableIncompleteVirtualEndPointLoadState.IEndPointLoader> ();

            _loadState = new TestableIncompleteVirtualEndPointLoadState(_endPointLoaderMock);

            _relatedEndPointStub1 = MockRepository.GenerateStub <IRealObjectEndPoint>();
            _relatedEndPointStub1.Stub(stub => stub.ObjectID).Return(DomainObjectIDs.Order1);
            _relatedEndPointStub1.Stub(stub => stub.ID).Return(RelationEndPointID.Create(DomainObjectIDs.Order1, typeof(Order), "Customer"));

            _relatedEndPointStub2 = MockRepository.GenerateStub <IRealObjectEndPoint> ();
            _relatedEndPointStub2.Stub(stub => stub.ObjectID).Return(DomainObjectIDs.Order3);
            _relatedEndPointStub2.Stub(stub => stub.ID).Return(RelationEndPointID.Create(DomainObjectIDs.Order3, typeof(Order), "Customer"));
        }
Ejemplo n.º 2
0
        public void FlattenedSerializable()
        {
            var endPointLoader =
                new SerializableVirtualEndPointLoaderFake <
                    IVirtualEndPoint <object>,
                    object,
                    IVirtualEndPointDataManager,
                    IVirtualEndPointLoadState <IVirtualEndPoint <object>, object, IVirtualEndPointDataManager> >();

            var state = new TestableIncompleteVirtualEndPointLoadState(endPointLoader);

            var oppositeEndPoint = new SerializableRealObjectEndPointFake(
                null,
                DomainObjectMother.CreateFakeObject <OrderTicket> (DomainObjectIDs.OrderTicket1));

            state.RegisterOriginalOppositeEndPoint(_virtualEndPointMock, oppositeEndPoint);

            var result = FlattenedSerializer.SerializeAndDeserialize(state);

            Assert.That(result, Is.Not.Null);
            Assert.That(result.OriginalOppositeEndPoints, Is.Not.Null);
            Assert.That(result.OriginalOppositeEndPoints, Is.Not.Empty);
            Assert.That(result.EndPointLoader, Is.Not.Null);
        }