public void WhenRelationIsNotOneToManyThenNoMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new OneToManyKeyColumnApplier(orm.Object); orm.Setup(x => x.IsOneToMany(It.Is<Type>(t => t == typeof(MyClass)), It.Is<Type>(t => t == typeof(MyRelated)))).Returns(false); var pathCollection = new PropertyPath(null, ForClass<MyClass>.Property(p => p.Relateds)); var pathMap = new PropertyPath(null, ForClass<MyClass>.Property(p => p.Map)); pattern.Match(pathCollection).Should().Be.False(); pattern.Match(pathMap).Should().Be.False(); }
public void WhenRelationIsNotOneToManyThenNoMatch() { var orm = new Mock <IDomainInspector>(); var pattern = new OneToManyKeyColumnApplier(orm.Object); orm.Setup(x => x.IsOneToMany(It.Is <Type>(t => t == typeof(MyClass)), It.Is <Type>(t => t == typeof(MyRelated)))).Returns(false); var pathCollection = new PropertyPath(null, ForClass <MyClass> .Property(p => p.Relateds)); var pathMap = new PropertyPath(null, ForClass <MyClass> .Property(p => p.Map)); pattern.Match(pathCollection).Should().Be.False(); pattern.Match(pathMap).Should().Be.False(); }
public void WhenAnyToManyThenNoMatch() { var orm = new ObjectRelationalMapper(); orm.TablePerClass <MyEntity>(); orm.TablePerClass <MyRelatedRoot1>(); orm.TablePerClass <MyRelatedRoot2>(); var applier = new OneToManyKeyColumnApplier(orm); applier.Match(new PropertyPath(null, ForClass <MyRelatedRoot1> .Property(x => x.Items))).Should().Be.False(); applier.Match(new PropertyPath(null, ForClass <MyRelatedRoot2> .Property(x => x.Items))).Should().Be.False(); }
public void WhenNoGenericCollectionThenNoMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new OneToManyKeyColumnApplier(orm.Object); var path = new PropertyPath(null, ForClass<MyClass>.Property(p => p.Something)); pattern.Match(path).Should().Be.False(); }
public void WhenNoGenericCollectionThenNoMatch() { var orm = new Mock <IDomainInspector>(); var pattern = new OneToManyKeyColumnApplier(orm.Object); var path = new PropertyPath(null, ForClass <MyClass> .Property(p => p.Something)); pattern.Match(path).Should().Be.False(); }
public void WhenRelationIsOneToManyForMapValueThenMatch() { var orm = new Mock <IDomainInspector>(); var pattern = new OneToManyKeyColumnApplier(orm.Object); orm.Setup(x => x.IsOneToMany(It.Is <Type>(t => t == typeof(MyClass)), It.Is <Type>(t => t == typeof(MyRelated)))).Returns(true); var path = new PropertyPath(null, ForClass <MyClass> .Property(p => p.Map)); pattern.Match(path).Should().Be.True(); }
public void WhenRelationIsOneToManyForMapValueThenMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new OneToManyKeyColumnApplier(orm.Object); orm.Setup(x => x.IsOneToMany(It.Is<Type>(t => t == typeof(MyClass)), It.Is<Type>(t => t == typeof(MyRelated)))).Returns(true); var path = new PropertyPath(null, ForClass<MyClass>.Property(p => p.Map)); pattern.Match(path).Should().Be.True(); }