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>(); }
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"); }
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); }
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(); }