public void WhenRegisterPropertySplitsThenTypeHasSplitGroups() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsPropertySplit(new SplitDefinition(typeof(MyClass), "group", For<MyClass>.Property(x => x.Something))); inspector.AddAsPropertySplit(new SplitDefinition(typeof(Inherited), "group1", For<Inherited>.Property(x => x.SomethingElse))); Assert.That(inspector.GetSplitGroupsFor(typeof(MyClass)), Is.EquivalentTo(new [] {"group"})); Assert.That(inspector.GetSplitGroupsFor(typeof(Inherited)), Is.EquivalentTo(new [] {"group1"})); }
public void WhenRegisterPropertySplitsThenTypeHasSplitGroups() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsPropertySplit(new SplitDefinition(typeof(MyClass), "group", For<MyClass>.Property(x => x.Something))); inspector.AddAsPropertySplit(new SplitDefinition(typeof(Inherited), "group1", For<Inherited>.Property(x => x.SomethingElse))); inspector.GetSplitGroupsFor(typeof(MyClass)).Should().Have.SameValuesAs("group"); inspector.GetSplitGroupsFor(typeof(Inherited)).Should().Have.SameValuesAs("group1"); }
public void WhenRegisterPropertySplitMoreThanOnceThenIgnore() { var inspector = new ExplicitlyDeclaredModel(); var memberFromDeclaringType = For<MyClass>.Property(x=> x.Something); var memberFromReferencedType = typeof(Inherited).GetProperty("Something"); inspector.AddAsPropertySplit(new SplitDefinition(typeof(MyClass), "group", memberFromDeclaringType)); inspector.AddAsPropertySplit(new SplitDefinition(typeof(Inherited), "group1", memberFromReferencedType)); Assert.That(inspector.GetSplitGroupsFor(typeof(MyClass)), Is.EquivalentTo(new [] {"group"})); Assert.That(inspector.GetSplitGroupsFor(typeof(Inherited)), Is.Empty); Assert.That(inspector.GetSplitGroupFor(memberFromDeclaringType), Is.EqualTo("group")); Assert.That(inspector.GetSplitGroupFor(memberFromReferencedType), Is.EqualTo("group")); }
public void WhenRegisterPropertySplitMoreThanOnceThenIgnore() { var inspector = new ExplicitlyDeclaredModel(); var memberFromDeclaringType = For<MyClass>.Property(x=> x.Something); var memberFromReferencedType = typeof(Inherited).GetProperty("Something"); inspector.AddAsPropertySplit(new SplitDefinition(typeof(MyClass), "group", memberFromDeclaringType)); inspector.AddAsPropertySplit(new SplitDefinition(typeof(Inherited), "group1", memberFromReferencedType)); inspector.GetSplitGroupsFor(typeof(MyClass)).Should().Have.SameValuesAs("group"); inspector.GetSplitGroupsFor(typeof(Inherited)).Should().Be.Empty(); inspector.GetSplitGroupFor(memberFromDeclaringType).Should().Be("group"); inspector.GetSplitGroupFor(memberFromReferencedType).Should().Be("group"); }
void IModelExplicitDeclarationsHolder.AddAsPropertySplit(SplitDefinition definition) { declaredModel.AddAsPropertySplit(definition); }