public void WhenNoRelationWithComponentThenMatch() { var orm = new Mock <IDomainInspector>(); var pattern = new CollectionOfElementsPattern(orm.Object); pattern.Match(ForClass <MyComponent> .Property(p => p.Strings)).Should().Be.True(); }
public void WhenNoGenericCollectionThenNoMatch() { var orm = new Mock <IDomainInspector>(); var pattern = new CollectionOfElementsPattern(orm.Object); pattern.Match(ForClass <MyClass> .Property(p => p.Something)).Should().Be.False(); }
public void WhenNoRelationWithComponentThenMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new CollectionOfElementsPattern(orm.Object); pattern.Match(ForClass<MyComponent>.Property(p => p.Strings)).Should().Be.True(); }
public void WhenNoRelationBetweenEntitiesThenMatch() { var orm = new Mock <IDomainInspector>(); var pattern = new CollectionOfElementsPattern(orm.Object); pattern.Match(ForClass <MyClass> .Property(p => p.Strings)).Should().Be.True(); pattern.Match(ForClass <MyClass> .Property(p => p.MapOfStrings)).Should().Be.True(); }
public void WhenRelationIsOneToManyInsideComponentThenNoMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new CollectionOfElementsPattern(orm.Object); orm.Setup(x => x.IsOneToMany(It.Is<Type>(t => t == typeof(MyComponent)), It.Is<Type>(t => t == typeof(MyRelated)))).Returns(true); pattern.Match(ForClass<MyComponent>.Property(p => p.Relateds)).Should().Be.False(); }
public void WhenRelationIsForMapKeyThenMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new CollectionOfElementsPattern(orm.Object); orm.Setup(x => x.IsManyToMany(It.Is<Type>(t => t == typeof(MyClass)), It.Is<Type>(t => t == typeof(MyRelated)))).Returns(true); pattern.Match(ForClass<MyClass>.Property(p => p.MapRelationOnKey)).Should().Be.True(); }
public void WhenNoRelationBetweenEntitiesThenMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new CollectionOfElementsPattern(orm.Object); pattern.Match(ForClass<MyClass>.Property(p => p.Strings)).Should().Be.True(); pattern.Match(ForClass<MyClass>.Property(p => p.MapOfStrings)).Should().Be.True(); }
public void WhenRelationIsOneToManyInsideComponentThenNoMatch() { var orm = new Mock <IDomainInspector>(); var pattern = new CollectionOfElementsPattern(orm.Object); orm.Setup(x => x.IsOneToMany(It.Is <Type>(t => t == typeof(MyComponent)), It.Is <Type>(t => t == typeof(MyRelated)))).Returns(true); pattern.Match(ForClass <MyComponent> .Property(p => p.Relateds)).Should().Be.False(); }
public void WhenRelationIsForMapKeyThenMatch() { var orm = new Mock <IDomainInspector>(); var pattern = new CollectionOfElementsPattern(orm.Object); orm.Setup(x => x.IsManyToMany(It.Is <Type>(t => t == typeof(MyClass)), It.Is <Type>(t => t == typeof(MyRelated)))).Returns(true); pattern.Match(ForClass <MyClass> .Property(p => p.MapRelationOnKey)).Should().Be.True(); }
public void WhenNoGenericCollectionThenNoMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new CollectionOfElementsPattern(orm.Object); pattern.Match(ForClass<MyClass>.Property(p => p.Something)).Should().Be.False(); }