protected override void Arrange() { _suppliedSourceEntityExtension1 = Stub <ISynchronizable>(); _suppliedSourceEntityExtension1 .Expect(x => x.Synchronize(Arg <object> .Is.Anything)) .Return(true); // Source extension entry, mapped from the resource object, will be a "transient" entity var sourceExtensions = new Dictionary <string, object>(); _suppliedSourceEntity = new FakeEntityWithExtensions(sourceExtensions); // Target extension entries during synchronization are "persistent" entities loaded through NHibernate, and due to the NHibernate mapping approach for extensions, will be a list with a single "persistent" entity _suppliedTargetEntityExtension1 = Stub <ISynchronizable>(); var targetExtensions = new Dictionary <string, object> { { "Extension1", new List <ISynchronizable> { _suppliedTargetEntityExtension1 } } }; _suppliedTargetEntity = new FakeEntityWithExtensions(targetExtensions); }
protected override void Arrange() { _suppliedSourceExtension1Object = MockRepository.GenerateStub <IMappableResource>(); _suppliedSourceExtension2Object = MockRepository.GenerateStub <IMappableResource>(); var sourceExtensions = new Dictionary <string, object> { { "Extension1", _suppliedSourceExtension1Object }, { "Extension2", _suppliedSourceExtension2Object } // Not supported }; // Source resource doesn't support Extension2 _suppliedSourceObject = new FakeEntityWithExtensions(sourceExtensions); _suppliedSourceObject.SetExtensionSupported("Extension2", false); var targetExtensions = new Dictionary <string, object>(); _suppliedTargetObject = new FakeEntityWithExtensions(targetExtensions); IHasExtensionsExtensions.CreateTargetExtensionObject = (t, x) => { var targetExtensionObjectMock = mocks.Stub <IMappableExtensionEntity>(); targetExtensionObjectMock.Replay(); _suppliedTargetExtensionObjectByExtensionName.Add(x, targetExtensionObjectMock); return(targetExtensionObjectMock); }; }
protected override void Arrange() { _suppliedSourceEntityExtension = Stub <ISynchronizable>(); A.CallTo(() => _suppliedSourceEntityExtension.Synchronize(A <object> ._)).Returns(true); // Source extension entry, mapped from the resource object, will be an ArrayList of "transient" entities var sourceExtensions = new Dictionary <string, object> { { "Extension1", new ArrayList { _suppliedSourceEntityExtension } } }; _suppliedSourceEntity = new FakeEntityWithExtensions(sourceExtensions); // Target extension entries during synchronization are "persistent" entities loaded through NHibernate, and due to the NHibernate mapping approach for extensions, will be a list with a single "persistent" entity _suppliedTargetEntityExtension = Stub <ISynchronizable>(); var targetExtensions = new Dictionary <string, object> { { "Extension1", new List <ISynchronizable> { _suppliedTargetEntityExtension } } }; _suppliedTargetEntity = new FakeEntityWithExtensions(targetExtensions); }
protected override void Arrange() { _suppliedSourceEntityExtension1 = Stub <ISynchronizable>(); _suppliedSourceEntityExtension2 = Stub <ISynchronizable>(); // First extension has modifications _suppliedSourceEntityExtension1 .Expect(x => x.Synchronize(Arg <object> .Is.Anything)) .Return(true); // Second extension has no modifications, but should not overwrite state _suppliedSourceEntityExtension2 .Expect(x => x.Synchronize(Arg <object> .Is.Anything)) .Return(false); // Source extension entry, mapped from the resource object, will be a ArrayList of "transient" entities var sourceExtensions = new Dictionary <string, object> { { "Extension1", new ArrayList { _suppliedSourceEntityExtension1 } }, { "Extension2", new ArrayList { _suppliedSourceEntityExtension2 } } }; _suppliedSourceEntity = new FakeEntityWithExtensions(sourceExtensions); // Target extension entries during synchronization are "persistent" entities loaded through NHibernate, and due to the NHibernate mapping approach for extensions, will be a list with a single "persistent" entity _suppliedTargetEntityExtension1 = Stub <ISynchronizable>(); _suppliedTargetEntityExtension2 = Stub <ISynchronizable>(); var targetExtensions = new Dictionary <string, object> { { "Extension1", new List <ISynchronizable> { _suppliedTargetEntityExtension1 } }, { "Extension2", new List <ISynchronizable> { _suppliedTargetEntityExtension2 } } }; _suppliedTargetEntity = new FakeEntityWithExtensions(targetExtensions); }
protected override void Arrange() { // Entity extensions are always wrapped in a list, due to NHibernate mappings var sourceExtensions = new Dictionary <string, object>(); _suppliedSourceObject = new FakeEntityWithExtensions(sourceExtensions); // Resources don't start with Extensions dictionary initialized _suppliedTargetObject = new FakeEntityWithExtensions(null); }
protected override void Arrange() { _suppliedSourceExtension1Object = MockRepository.GenerateStub <IMappableExtensionEntity>(); _suppliedSourceExtension2Object = MockRepository.GenerateStub <IMappableExtensionEntity>(); _suppliedEmptyImplicitSourceExtensionObject = MockRepository.GenerateStub <IMappableImplicitExtensionEntity>(); _suppliedNonEmptyImplicitSourceExtensionObject = MockRepository.GenerateStub <IMappableImplicitExtensionEntity>(); _suppliedEmptyImplicitSourceExtensionObject.Expect(x => x.IsEmpty()).Return(true); _suppliedNonEmptyImplicitSourceExtensionObject.Expect(x => x.IsEmpty()).Return(false); // Entity extensions are always wrapped in a list, due to NHibernate mappings var sourceExtensions = new Dictionary <string, object> { { "Extension1", new List <IMappableExtensionEntity> { _suppliedSourceExtension1Object } }, { "Extension2", new List <IMappableExtensionEntity> { _suppliedSourceExtension2Object } }, { "EmptyImplicitExtension", new List <IMappableExtensionEntity> { _suppliedEmptyImplicitSourceExtensionObject } }, { "NonEmptyImplicitExtension", new List <IMappableExtensionEntity> { _suppliedNonEmptyImplicitSourceExtensionObject } }, }; _suppliedSourceObject = new FakeEntityWithExtensions(sourceExtensions); // Resources don't start with Extensions initialized _suppliedTargetObject = new FakeEntityWithExtensions(null); IHasExtensionsExtensions.CreateTargetExtensionObject = (t, x) => { var targetExtensionObjectMock = mocks.Stub <IMappableResource>(); targetExtensionObjectMock.Replay(); _suppliedTargetExtensionObjectByExtensionName.Add(x, targetExtensionObjectMock); return(targetExtensionObjectMock); }; }
protected override void Arrange() { _suppliedSourceExtension1Object = MockRepository.GenerateStub <IMappableExtensionEntity>(); _suppliedSourceExtension2Object = MockRepository.GenerateStub <IMappableExtensionEntity>(); // Entity extensions are always wrapped in a list, due to NHibernate mappings var sourceExtensions = new Dictionary <string, object> { { "Extension1", new List <IMappableExtensionEntity> { _suppliedSourceExtension1Object } }, { "Extension2", new List <IMappableExtensionEntity> { _suppliedSourceExtension2Object } } }; _suppliedSourceObject = new FakeEntityWithExtensions(sourceExtensions); var targetExtensions = new Dictionary <string, object>(); _suppliedTargetObject = new FakeEntityWithExtensions(targetExtensions); IHasExtensionsExtensions.CreateTargetExtensionObject = (t, x) => { var targetExtensionObjectMock = mocks.Stub <IMappableExtensionEntity>(); targetExtensionObjectMock.Replay(); _suppliedTargetExtensionObjectByExtensionName.Add(x, targetExtensionObjectMock); return(targetExtensionObjectMock); }; }
protected override void Arrange() { _suppliedSourceExtension1Object = Stub <IMappableResource>(); _suppliedSourceExtension2Object = Stub <IMappableResource>(); _suppliedUnsupportedExtensionObject = Stub <IMappableResource>(); var sourceExtensions = new Dictionary <string, object> { { "Extension1", _suppliedSourceExtension1Object }, { "Extension2", _suppliedSourceExtension2Object }, { "UnsupportedExtension", _suppliedUnsupportedExtensionObject } }; _suppliedSourceObject = new FakeEntityWithExtensions(sourceExtensions); _suppliedSourceObject.SetExtensionSupported("UnsupportedExtension", false); var targetExtensions = new Dictionary <string, object>(); _suppliedTargetObject = new FakeEntityWithExtensions(targetExtensions); IHasExtensionsExtensions.CreateTargetExtensionObject = (t, x) => { var targetExtensionObjectMock = Stub <IMappableExtensionEntity>(); _suppliedTargetExtensionObjectByExtensionName.Add(x, targetExtensionObjectMock); return(targetExtensionObjectMock); }; }