protected override void Arrange()
            {
                _suppliedSourceEntityExtension1 = Stub <ISynchronizable>();

                A.CallTo(() => _suppliedSourceEntityExtension1.Synchronize(A <object> ._)).Returns(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()
            {
                _suppliedSourceEntityExtension1 = Stub <ISynchronizable>();
                _suppliedSourceEntityExtension2 = Stub <ISynchronizable>();

                // First extension has modifications
                A.CallTo(() => _suppliedSourceEntityExtension1.Synchronize(A <object> ._)).Returns(true);

                // Second extension has no modifications, but should not overwrite state
                A.CallTo(() => _suppliedSourceEntityExtension2.Synchronize(A <object> ._)).Returns(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);
            }
 Should_obtain_the_target_entity_extension_from_the_list_and_use_it_as_the_synchronization_target_for_the_source_entity_extension()
 {
     A.CallTo(() => _suppliedSourceEntityExtension.Synchronize(_suppliedTargetEntityExtension)).MustHaveHappenedOnceExactly();
 }
 public void Should_not_attempt_to_synchronize_extensions_that_are_not_present_on_the_target()
 {
     A.CallTo(() => _suppliedSourceEntityExtension2.Synchronize(A <string> ._)).MustNotHaveHappened();
 }
 public void Should_attempt_to_synchronize_extensions_that_are_present_on_the_target()
 {
     A.CallTo(() => _suppliedSourceEntityExtension1.Synchronize(_suppliedTargetEntityExtension1)).MustHaveHappened();
 }
 public void Should_not_attempt_to_synchronize_extensions_that_are_not_supported_as_a_synchronization_source()
 {
     A.CallTo(() => _suppliedSourceEntityExtension2.Synchronize(A <string> ._)).MustNotHaveHappened();
 }
 public void Should_attempt_to_synchronize_extensions_that_are_supported_as_a_synchronization_source()
 {
     A.CallTo(() => _suppliedSourceEntityExtension1.Synchronize(_suppliedTargetEntityExtension1)).MustHaveHappenedOnceExactly();
 }