public void UnifyWithEquivalentProperties_ThrowsForDifferentStoragePropertyType()
        {
            var property2 = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty();

            Assert.That(
                () => _objectIDWithoutClassIDStoragePropertyDefinition.UnifyWithEquivalentProperties(new[] { property2 }),
                Throws.ArgumentException.With.Message.EqualTo(
                    "Only equivalent properties can be combined, but this property has type 'ObjectIDWithoutClassIDStoragePropertyDefinition', and the "
                    + "given property has type 'SimpleStoragePropertyDefinition'.\r\nParameter name: equivalentProperties"));
        }
        public void UnifyWithEquivalentProperties_CombinesProperties()
        {
            var valueProperty1Mock = MockRepository.GenerateStrictMock <IRdbmsStoragePropertyDefinition> ();
            var property1          = new ObjectIDWithoutClassIDStoragePropertyDefinition(valueProperty1Mock, _classDefinition);

            var valueProperty2Stub = MockRepository.GenerateStub <IRdbmsStoragePropertyDefinition> ();
            var property2          = new ObjectIDWithoutClassIDStoragePropertyDefinition(valueProperty2Stub, _classDefinition);

            var valueProperty3Stub = MockRepository.GenerateStub <IRdbmsStoragePropertyDefinition> ();
            var property3          = new ObjectIDWithoutClassIDStoragePropertyDefinition(valueProperty3Stub, _classDefinition);

            var fakeUnifiedValueProperty = MockRepository.GenerateStub <IRdbmsStoragePropertyDefinition> ();

            valueProperty1Mock
            .Expect(
                mock => mock.UnifyWithEquivalentProperties(
                    Arg <IEnumerable <IRdbmsStoragePropertyDefinition> > .List.Equal(new[] { valueProperty2Stub, valueProperty3Stub })))
            .Return(fakeUnifiedValueProperty);

            var result = property1.UnifyWithEquivalentProperties(new[] { property2, property3 });

            fakeUnifiedValueProperty.VerifyAllExpectations();

            Assert.That(result, Is.TypeOf <ObjectIDWithoutClassIDStoragePropertyDefinition> ());
            Assert.That(((ObjectIDWithoutClassIDStoragePropertyDefinition)result).ValueProperty, Is.SameAs(fakeUnifiedValueProperty));
            Assert.That(((ObjectIDWithoutClassIDStoragePropertyDefinition)result).ClassDefinition, Is.SameAs(_classDefinition));
        }