Пример #1
0
        public void XmlDeserialize_WithNullObjectID()
        {
            byte[]           serializedArray = Encoding.UTF8.GetBytes(XmlSerializationStrings.XmlForComputer4);
            XmlTransportItem item            = XmlSerializationHelper.XmlDeserialize <XmlTransportItem> (serializedArray);

            Assert.That(item.TransportItem.Properties[ReflectionMappingHelper.GetPropertyName(typeof(Computer), "Employee")], Is.Null);
        }
Пример #2
0
        public void RelationEndPointManager_Content()
        {
            DomainObjectIDs.Order1.GetObject <Order> ().OrderItems.EnsureDataComplete();
            Assert.That(_relationEndPointManager.RelationEndPoints.Count, Is.EqualTo(7));

            var deserializedManager = (RelationEndPointManager)DataManagerTestHelper.GetRelationEndPointManager(
                Serializer.SerializeAndDeserialize(TestableClientTransaction.DataManager));

            Assert.That(deserializedManager.ClientTransaction, Is.Not.Null);
            Assert.That(deserializedManager.ClientTransaction, Is.InstanceOf(typeof(TestableClientTransaction)));
            Assert.That(deserializedManager.ClientTransaction, Is.Not.SameAs(TestableClientTransaction));
            Assert.That(deserializedManager.LazyLoader, Is.Not.Null);
            Assert.That(deserializedManager.LazyLoader, Is.TypeOf(_relationEndPointManager.LazyLoader.GetType()));
            Assert.That(deserializedManager.EndPointFactory, Is.Not.Null);
            Assert.That(deserializedManager.EndPointFactory, Is.TypeOf(_relationEndPointManager.EndPointFactory.GetType()));
            Assert.That(deserializedManager.RegistrationAgent, Is.TypeOf(_relationEndPointManager.RegistrationAgent.GetType()));
            Assert.That(deserializedManager.DataContainerEndPointsRegistrationAgent, Is.Not.Null);

            Assert.That(deserializedManager.RelationEndPoints.Count, Is.EqualTo(7));

            var endPointID = RelationEndPointID.Create(DomainObjectIDs.Order1, ReflectionMappingHelper.GetPropertyName(typeof(Order), "OrderItems"));
            var endPoint   = (ICollectionEndPoint)deserializedManager.GetRelationEndPointWithoutLoading(endPointID);

            Assert.That(endPoint.ClientTransaction, Is.SameAs(deserializedManager.ClientTransaction));
        }
        public override void SetUp()
        {
            base.SetUp();
            var id = RelationEndPointID.Create(DomainObjectIDs.Computer1, ReflectionMappingHelper.GetPropertyName(typeof(Computer), "Employee"));

            _endPoint = new TestableRelationEndPoint(TestableClientTransaction, id);
        }
Пример #4
0
        public void RaiseRelationEndPointBecomingIncompleteEvent()
        {
            var endPointID = RelationEndPointID.Create(DomainObjectIDs.Order1, ReflectionMappingHelper.GetPropertyName(typeof(Order), "OrderItems"));

            CheckEventWithListenersOnly(
                s => s.RaiseRelationEndPointBecomingIncompleteEvent(endPointID),
                l => l.RelationEndPointBecomingIncomplete(_clientTransaction, endPointID));
        }
        public override void SetUp()
        {
            base.SetUp();

            DomainObjectIDs.Computer1.GetObject <Computer> ();
            var endPointID = RelationEndPointID.Create(DomainObjectIDs.Computer1, ReflectionMappingHelper.GetPropertyName(typeof(Computer), "Employee"));

            _endPoint = (RealObjectEndPoint)TestableClientTransaction.DataManager.GetRelationEndPointWithoutLoading(endPointID);
        }
Пример #6
0
        public void ChangedBySource_PropertyValue()
        {
            byte[] binaryData = GetBinaryDataForChangedObject(
                DomainObjectIDs.Order1, ReflectionMappingHelper.GetPropertyName(typeof(Order), "OrderNumber"), 2);

            var imported = DomainObjectTransporterTestHelper.ImportObjects(binaryData);

            Assert.That(((Order)imported[0]).OrderNumber, Is.EqualTo(2));
        }
        public override void SetUp()
        {
            base.SetUp();

            var endPointID = RelationEndPointID.Create(DomainObjectIDs.Employee3, ReflectionMappingHelper.GetPropertyName(typeof(Employee), "Computer"));

            _endPoint = (VirtualObjectEndPoint)
                        ((StateUpdateRaisingVirtualObjectEndPointDecorator)TestableClientTransaction.DataManager.GetRelationEndPointWithLazyLoad(endPointID))
                        .InnerEndPoint;
        }
        public override void SetUp()
        {
            base.SetUp();

            Dev.Null = DomainObjectIDs.Order1.GetObject <Order> ().OrderItems;
            var endPointID = RelationEndPointID.Create(DomainObjectIDs.Order1, ReflectionMappingHelper.GetPropertyName(typeof(Order), "OrderItems"));

            _endPoint = (CollectionEndPoint)
                        ((StateUpdateRaisingCollectionEndPointDecorator)TestableClientTransaction.DataManager.GetRelationEndPointWithoutLoading(endPointID)).InnerEndPoint;
        }
        public override void SetUp()
        {
            base.SetUp();
            _mockRepository = new MockRepository();
            _id             = RelationEndPointID.Create(DomainObjectIDs.Computer1,
                                                        ReflectionMappingHelper.GetPropertyName(typeof(Computer), "Employee"));

            _endPointMock = _mockRepository.StrictMock <IRelationEndPoint> ();

            _command = new NullEndPointModificationCommand(_endPointMock);
        }
Пример #10
0
        public void ExistingObjects_ChangedBySource()
        {
            byte[] binaryData = GetBinaryDataForChangedObject(
                DomainObjectIDs.ClassWithAllDataTypes1,
                ReflectionMappingHelper.GetPropertyName(typeof(ClassWithAllDataTypes), "Int32Property"),
                12);

            var imported = DomainObjectTransporterTestHelper.ImportObjects(binaryData);

            Assert.That(imported[0].State, Is.EqualTo(StateType.Changed));
            Assert.That(((ClassWithAllDataTypes)imported[0]).Int32Property, Is.EqualTo(12));
        }
        public override void SetUp()
        {
            base.SetUp();

            _id = RelationEndPointID.Create(DomainObjectIDs.Computer1, ReflectionMappingHelper.GetPropertyName(typeof(Computer), "Employee"));
        }
Пример #12
0
        public void RaiseVirtualRelationEndPointStateUpdatedEvent()
        {
            var endPointID             = RelationEndPointID.Create(DomainObjectIDs.Order1, ReflectionMappingHelper.GetPropertyName(typeof(Order), "OrderItems"));
            var newEndPointChangeState = BooleanObjectMother.GetRandomBoolean();

            CheckEventWithListenersOnly(
                s => s.RaiseVirtualRelationEndPointStateUpdatedEvent(endPointID, newEndPointChangeState),
                l => l.VirtualRelationEndPointStateUpdated(_clientTransaction, endPointID, newEndPointChangeState));
        }