Esempio n. 1
0
        public void CallDictionaryMappers()
        {
            var properties            = new List <object>();
            var map                   = new StubPropertyContainerMapper <MyClassWithDictionary>(properties);
            var collectionPropsCalled = false;
            var keyRelationCalled     = false;
            var elementRelationCalled = false;

            map.Map(typeof(MyClassWithDictionary).GetProperty("Dictionary"), cp => collectionPropsCalled = true,
                    km => keyRelationCalled = true, er => elementRelationCalled = true);

            collectionPropsCalled.Should().Be.True();
            keyRelationCalled.Should().Be.True();
            elementRelationCalled.Should().Be.True();
        }
Esempio n. 2
0
        public void CallDictionaryMappers()
        {
            var properties            = new List <object>();
            var map                   = new StubPropertyContainerMapper <EntitySimple>(properties);
            var collectionPropsCalled = false;
            var keyRelationCalled     = false;
            var elementRelationCalled = false;

            map.Map(typeof(MyClassWithDictionary).GetProperty("Dictionary"), cp => collectionPropsCalled = true,
                    km => keyRelationCalled = true, er => elementRelationCalled = true);

            Assert.That(collectionPropsCalled, Is.True);
            Assert.That(keyRelationCalled, Is.True);
            Assert.That(elementRelationCalled, Is.True);
        }
Esempio n. 3
0
        public void CanAddComponentPropertyAndItsProperties()
        {
            var properties = new List <object>();
            var map        = new StubPropertyContainerMapper <Zoo>(properties);

            map.Component(zoo => zoo.Address, comp =>
            {
                comp.Property(address => address.City);
                comp.Property(address => address.PostalCode);
            });

            properties.Should().Have.Count.EqualTo(1);
            var component = (HbmComponent)properties.First();

            component.Items.Should().Have.Count.EqualTo(2);
        }
        public void CantAddPropertyOfNotInheritedType()
        {
            var map = new StubPropertyContainerMapper <OtherSimple>(new List <object>());

            Assert.That(() => map.Property(typeof(EntitySimple).GetProperty("Name"), x => { }), Throws.TypeOf <ArgumentOutOfRangeException>());
        }
        public void CantAddPropertyOfNotInheritedType()
        {
            var map = new StubPropertyContainerMapper <OtherSimple>(new List <object>());

            Executing.This(() => map.Property(typeof(EntitySimple).GetProperty("Name"), x => { })).Should().Throw <ArgumentOutOfRangeException>();
        }