public void WhenNoRelationWithComponentThenMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new CollectionOfElementsOnlyPattern(orm.Object); pattern.Match(ForClass<MyComponent>.Property(p => p.Strings)).Should().Be.True(); }
public void WhenRelationIsOneToManyInsideComponentThenNoMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new CollectionOfElementsOnlyPattern(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 WhenNoGenericCollectionThenNoMatch() { var orm = new Mock<IDomainInspector>(); var pattern = new CollectionOfElementsOnlyPattern(orm.Object); pattern.Match(ForClass<MyClass>.Property(p => p.Something)).Should().Be.False(); }