Beispiel #1
0
        public void ModifyingProperty_Loaded()
        {
            _transporter.Load(DomainObjectIDs.Computer1);

            var source = (Computer)_transporter.GetTransportedObject(DomainObjectIDs.Computer1);

            _listener.PropertyValueChanging(TestableClientTransaction, source, GetPropertyDefinition(typeof(Computer), "SerialNumber"), null, null);
        }
Beispiel #2
0
        public void ChangedBySource_RelatedObjectToExistingObject_VirtualSide()
        {
            var transporter = new DomainObjectTransporter();

            transporter.Load(DomainObjectIDs.Computer1);
            transporter.Load(DomainObjectIDs.Computer2);
            transporter.Load(DomainObjectIDs.Employee3);
            transporter.Load(DomainObjectIDs.Employee4);
            var employee = (Employee)transporter.GetTransportedObject(DomainObjectIDs.Employee3);

            employee.Computer = (Computer)transporter.GetTransportedObject(DomainObjectIDs.Computer2);

            byte[] binaryData    = DomainObjectTransporterTestHelper.GetBinaryDataFor(transporter);
            var    imported      = DomainObjectTransporterTestHelper.ImportObjects(binaryData);
            var    loadedObject1 = (Computer)imported.Find(obj => obj.ID == DomainObjectIDs.Computer2);
            var    loadedObject2 = (Employee)imported.Find(obj => obj.ID == DomainObjectIDs.Employee3);

            Assert.That(loadedObject2.Computer, Is.SameAs(loadedObject1));
        }
Beispiel #3
0
        private byte[] GetBinaryDataForChangedObject(ObjectID id, string propertyToTouch, object newValue)
        {
            var transporter = new DomainObjectTransporter();

            transporter.Load(id);
            var domainObject = transporter.GetTransportedObject(id);
            var properties   = new PropertyIndexer(domainObject);

            properties[propertyToTouch].SetValueWithoutTypeCheck(newValue);
            return(DomainObjectTransporterTestHelper.GetBinaryDataFor(transporter));
        }
Beispiel #4
0
        public void Load()
        {
            DomainObject domainObject = _transporter.Load(DomainObjectIDs.Order1);

            Assert.That(_transporter.ObjectIDs.Count, Is.EqualTo(1));
            Assert.That(_transporter.ObjectIDs, Is.EqualTo(new[] { DomainObjectIDs.Order1 }));

            Assert.That(_transporter.GetTransportedObject(domainObject.ID), Is.SameAs(domainObject));
        }