private void CheckCurrentOppositeEndPoint(RealObjectEndPoint expected) { var loadState = (CompleteVirtualObjectEndPointLoadState)VirtualObjectEndPointTestHelper.GetLoadState(_virtualObjectEndPoint); var dataManager = (VirtualObjectEndPointDataManager)loadState.DataManager; Assert.That(dataManager.CurrentOppositeEndPoint, Is.SameAs(expected)); }
public void Initialization_SyncState() { var endPoint = new RealObjectEndPoint(TestableClientTransaction, _endPointID, _foreignKeyDataContainer, _endPointProviderStub, _transactionEventSinkStub); var syncState = RealObjectEndPointTestHelper.GetSyncState(endPoint); Assert.That(syncState, Is.TypeOf(typeof(UnknownRealObjectEndPointSyncState))); Assert.That(((UnknownRealObjectEndPointSyncState)syncState).VirtualEndPointProvider, Is.SameAs(_endPointProviderStub)); }
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); }
public override void SetUp() { base.SetUp(); _domainObject = DomainObjectIDs.OrderItem1.GetObject <OrderItem>(); _oldRelatedObject = _domainObject.Order; _newRelatedObject = DomainObjectIDs.Order3.GetObject <Order> (); _endPointID = RelationEndPointID.Resolve(_domainObject, oi => oi.Order); _endPoint = (RealObjectEndPoint)RelationEndPointObjectMother.CreateObjectEndPoint(_endPointID, _oldRelatedObject.ID); _command = new ObjectEndPointSetOneManyCommand(_endPoint, _newRelatedObject, OppositeObjectSetter, EndPointProviderStub, TransactionEventSinkWithMock); }
public void SetOppositeObjectDataFromSubTransaction() { Assert.That(_endPoint.OppositeObjectID, Is.Not.EqualTo(DomainObjectIDs.Order3)); var sourceDataContainer = DataContainer.CreateForExisting(_endPointID.ObjectID, null, pd => pd.DefaultValue); var source = new RealObjectEndPoint(TestableClientTransaction, _endPointID, sourceDataContainer, _endPointProviderStub, _transactionEventSinkStub); RealObjectEndPointTestHelper.SetValueViaDataContainer(source, DomainObjectIDs.Order3); PrivateInvoke.InvokeNonPublicMethod(_endPoint, "SetOppositeObjectDataFromSubTransaction", source); Assert.That(_endPoint.OppositeObjectID, Is.EqualTo(DomainObjectIDs.Order3)); Assert.That(_endPoint.HasChanged, Is.True); }
public override void SetUp() { base.SetUp(); _endPointID = RelationEndPointObjectMother.CreateRelationEndPointID(DomainObjectIDs.OrderTicket1, "Order"); _foreignKeyDataContainer = DataContainer.CreateForExisting(_endPointID.ObjectID, null, pd => pd.DefaultValue); _endPointProviderStub = MockRepository.GenerateStub <IRelationEndPointProvider>(); _transactionEventSinkStub = MockRepository.GenerateStub <IClientTransactionEventSink>(); _syncStateMock = MockRepository.GenerateStrictMock <IRealObjectEndPointSyncState> (); _endPoint = new RealObjectEndPoint( TestableClientTransaction, _endPointID, _foreignKeyDataContainer, _endPointProviderStub, _transactionEventSinkStub); PrivateInvoke.SetNonPublicField(_endPoint, "_syncState", _syncStateMock); }
public override void SetUp() { base.SetUp(); _employee1 = Employee.NewObject(); _computer1 = Computer.NewObject(); _computer2 = Computer.NewObject(); _employee1.Computer = _computer1; TestableClientTransaction.CreateSubTransaction().EnterDiscardingScope(); _employee1.Computer.EnsureDataAvailable(); _virtualObjectEndPoint = (VirtualObjectEndPoint)GetEndPoint <StateUpdateRaisingVirtualObjectEndPointDecorator> (RelationEndPointID.Resolve(_employee1, o => o.Computer)).InnerEndPoint; _computer1EndPoint = GetEndPoint <RealObjectEndPoint> (RelationEndPointID.Resolve(_computer1, oi => oi.Employee)); _computer2EndPoint = GetEndPoint <RealObjectEndPoint> (RelationEndPointID.Resolve(_computer2, oi => oi.Employee)); }
public override void SetUp() { base.SetUp(); _folder1 = Folder.NewObject(); _fileSystemItem1 = FileSystemItem.NewObject(); _fileSystemItem2 = FileSystemItem.NewObject(); _fileSystemItem3 = FileSystemItem.NewObject(); _folder1.FileSystemItems.Add(_fileSystemItem1); _folder1.FileSystemItems.Add(_fileSystemItem2); TestableClientTransaction.CreateSubTransaction().EnterDiscardingScope(); _folder1.FileSystemItems.EnsureDataComplete(); _collectionEndPoint = (CollectionEndPoint)GetEndPoint <StateUpdateRaisingCollectionEndPointDecorator> (RelationEndPointID.Resolve(_folder1, o => o.FileSystemItems)).InnerEndPoint; _fileSystemItem1EndPoint = GetEndPoint <RealObjectEndPoint> (RelationEndPointID.Resolve(_fileSystemItem1, oi => oi.ParentFolder)); _fileSystemItem2EndPoint = GetEndPoint <RealObjectEndPoint> (RelationEndPointID.Resolve(_fileSystemItem2, oi => oi.ParentFolder)); _fileSystemItem3EndPoint = GetEndPoint <RealObjectEndPoint> (RelationEndPointID.Resolve(_fileSystemItem3, oi => oi.ParentFolder)); }
public static bool HasBeenTouchedViaDataContainer(RealObjectEndPoint realObjectEndPoint) { return(realObjectEndPoint.ForeignKeyDataContainer.HasValueBeenTouched(realObjectEndPoint.PropertyDefinition)); }
public static void SetValueViaDataContainer(RealObjectEndPoint realObjectEndPoint, ObjectID objectID) { realObjectEndPoint.ForeignKeyDataContainer.SetValue(realObjectEndPoint.PropertyDefinition, objectID); }
public static object GetValueViaDataContainer(RealObjectEndPoint realObjectEndPoint) { return(realObjectEndPoint.ForeignKeyDataContainer.GetValue(realObjectEndPoint.PropertyDefinition)); }
public static IRealObjectEndPointSyncState GetSyncState(RealObjectEndPoint objectEndPoint) { return((IRealObjectEndPointSyncState)PrivateInvoke.GetNonPublicField(objectEndPoint, "_syncState")); }
public static void SetOppositeObjectID(RealObjectEndPoint objectEndPoint, ObjectID newID) { PrivateInvoke.InvokeNonPublicMethod(objectEndPoint, "SetOppositeObjectID", newID); }