public void WhenRegisterUnionSubclassWithNoRootThenThrows() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsTablePerConcreteClassEntity(typeof(Inherited1)); Assert.That(() => inspector.IsTablePerConcreteClass(typeof(Inherited1)), Throws.TypeOf<MappingException>()); }
public void WhenRegisterUnionSubclassWithNoRootThenThrows() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsTablePerConcreteClassEntity(typeof(Inherited1)); inspector.Executing(x => x.IsTablePerConcreteClass(typeof(Inherited1))).Throws<MappingException>(); }
public void WhenRegisterUnionSubclassBeforeRootThenIsRegistered() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsTablePerConcreteClassEntity(typeof(Inherited1)); inspector.AddAsRootEntity(typeof(MyClass)); inspector.IsTablePerConcreteClass(typeof(Inherited1)).Should().Be.True(); }
public void WhenRegisteredAsUnionSubclassThenIsEntity() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsRootEntity(typeof(MyClass)); inspector.AddAsTablePerConcreteClassEntity(typeof(Inherited1)); Assert.That(inspector.IsEntity(typeof(Inherited1)), Is.True); }
public void WhenRegisteredConcreteClassThenTheStrategyIsDefinedEvenForRoot() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsRootEntity(typeof(MyClass)); inspector.AddAsTablePerConcreteClassEntity(typeof(Inherited1)); inspector.IsTablePerClass(typeof(MyClass)).Should().Be.False(); inspector.IsTablePerClassHierarchy(typeof(MyClass)).Should().Be.False(); inspector.IsTablePerConcreteClass(typeof(MyClass)).Should().Be.True(); }
public void WhenRegisteredAsDeepUnionSubclassThenIsRegistered() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsRootEntity(typeof(MyClass)); inspector.AddAsTablePerConcreteClassEntity(typeof(Inherited2)); inspector.IsTablePerClass(typeof(Inherited2)).Should().Be.False(); inspector.IsTablePerClassHierarchy(typeof(Inherited2)).Should().Be.False(); inspector.IsTablePerConcreteClass(typeof(Inherited2)).Should().Be.True(); }
public void WhenRegisteredAsComponetThenCantRegisterAsUnionSubclass() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsComponent(typeof (MyComponent)); Assert.That(() => { inspector.AddAsTablePerConcreteClassEntity(typeof (MyComponent)); inspector.IsTablePerConcreteClass(typeof (MyComponent)); }, Throws.TypeOf<MappingException>()); }
public void WhenRegisteredAsComponetThenCantRegisterAsUnionSubclass() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsComponent(typeof (MyComponent)); Executing.This(() => { inspector.AddAsTablePerConcreteClassEntity(typeof (MyComponent)); inspector.IsTablePerConcreteClass(typeof (MyComponent)); }).Should().Throw<MappingException>(); }
public void WhenRegisteredAsJoinedSubclassThenCantRegisterAsUnionSubclass() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsRootEntity(typeof (MyClass)); inspector.AddAsTablePerClassEntity(typeof (Inherited1)); Executing.This(() => { inspector.AddAsTablePerConcreteClassEntity(typeof (Inherited1)); inspector.IsTablePerClass(typeof (Inherited1)); }).Should().Throw<MappingException>(); }
public void WhenRegisteredAsJoinedSubclassThenCantRegisterAsUnionSubclass() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsRootEntity(typeof (MyClass)); inspector.AddAsTablePerClassEntity(typeof (Inherited1)); Assert.That(() => { inspector.AddAsTablePerConcreteClassEntity(typeof (Inherited1)); inspector.IsTablePerClass(typeof (Inherited1)); }, Throws.TypeOf<MappingException>()); }
public void WhenRegisteredDeepConcreteClassThenTheStrategyIsDefinedEvenForRoot() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsRootEntity(typeof(MyClass)); inspector.AddAsTablePerConcreteClassEntity(typeof(Inherited2)); Assert.That(inspector.IsTablePerClass(typeof(MyClass)), Is.False); Assert.That(inspector.IsTablePerClassHierarchy(typeof(MyClass)), Is.False); Assert.That(inspector.IsTablePerConcreteClass(typeof(MyClass)), Is.True); }
void IModelExplicitDeclarationsHolder.AddAsTablePerConcreteClassEntity(System.Type type) { declaredModel.AddAsTablePerConcreteClassEntity(type); }