Beispiel #1
0
        public void WhenRelationThenAddMapPropertyWithSpecificRelation()
        {
            var properties = new List <object>();
            var map        = new StubPropertyContainerMapper <Human>(properties);

            map.Map(human => human.Family, cm => { }, rel => rel.ManyToMany());

            properties.Should().Have.Count.EqualTo(1);
            object first = properties.First();

            first.Should().Be.OfType <HbmMap>().And.ValueOf.ElementRelationship.Should().Be.OfType <HbmManyToMany>();
        }
Beispiel #2
0
        public void CanAddMapProperty()
        {
            var properties = new List <object>();
            var map        = new StubPropertyContainerMapper <Zoo>(properties);

            map.Map(zoo => zoo.Mammals, cm => { });

            properties.Should().Have.Count.EqualTo(1);
            object first = properties.First();

            first.Should().Be.OfType <HbmMap>().And.ValueOf.Name.Should().Be.EqualTo("Mammals");
        }
Beispiel #3
0
        public void WhenNoRelationThenAddMapPropertyWithElement()
        {
            var properties = new List <object>();
            var map        = new StubPropertyContainerMapper <MyEntity>(properties);

            map.Map(myEntity => myEntity.Dictionary, cm => { });

            properties.Should().Have.Count.EqualTo(1);
            object first = properties.First();

            first.Should().Be.OfType <HbmMap>().And.ValueOf.ElementRelationship.Should().Be.OfType <HbmElement>().And.ValueOf.Type.
            name.Should().Be.EqualTo("String");
        }
        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);
        }
Beispiel #5
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();
        }