public void WhenRegisterSubclassWithNoRootThenThrows() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited1)); Assert.That(() => inspector.IsTablePerClassHierarchy(typeof(Inherited1)), Throws.TypeOf<MappingException>()); }
public void WhenRegisterSubclassWithNoRootThenThrows() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited1)); inspector.Executing(x => x.IsTablePerClassHierarchy(typeof(Inherited1))).Throws<MappingException>(); }
public void WhenRegisterSubclassBeforeRootThenIsRegistered() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited1)); inspector.AddAsRootEntity(typeof(MyClass)); inspector.IsTablePerClassHierarchy(typeof(Inherited1)).Should().Be.True(); }
public void WhenRegisteredAsSubclassThenIsEntity() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsRootEntity(typeof(MyClass)); inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited1)); Assert.That(inspector.IsEntity(typeof(Inherited1)), Is.True); }
public void WhenRegisteredAsSubclassThenCantRegisterAsUnionSubclass() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsRootEntity(typeof(MyClass)); inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited1)); inspector.Executing(x => x.AddAsTablePerConcreteClassEntity(typeof(Inherited1))).Throws<MappingException>(); }
public void WhenRegisteredSubclassThenTheStrategyIsDefinedEvenForRoot() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsRootEntity(typeof(MyClass)); inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited1)); inspector.IsTablePerClass(typeof(MyClass)).Should().Be.False(); inspector.IsTablePerClassHierarchy(typeof(MyClass)).Should().Be.True(); inspector.IsTablePerConcreteClass(typeof(MyClass)).Should().Be.False(); }
public void WhenRegisteredAsDeepSubclassThenIsRegistered() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsRootEntity(typeof(MyClass)); inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited2)); inspector.IsTablePerClass(typeof(Inherited2)).Should().Be.False(); inspector.IsTablePerClassHierarchy(typeof(Inherited2)).Should().Be.True(); inspector.IsTablePerConcreteClass(typeof(Inherited2)).Should().Be.False(); }
public void WhenRegisteredDeepSubclassThenTheStrategyIsDefinedEvenForRoot() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsRootEntity(typeof(MyClass)); inspector.AddAsTablePerClassHierarchyEntity(typeof(Inherited2)); Assert.That(inspector.IsTablePerClass(typeof(MyClass)), Is.False); Assert.That(inspector.IsTablePerClassHierarchy(typeof(MyClass)), Is.True); Assert.That(inspector.IsTablePerConcreteClass(typeof(MyClass)), Is.False); }
public void WhenRegisteredAsComponetThenCantRegisterAsSubclass() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsComponent(typeof (MyComponent)); Assert.That(() => { inspector.AddAsTablePerClassHierarchyEntity(typeof (MyComponent)); inspector.IsTablePerClassHierarchy(typeof (MyComponent)); }, Throws.TypeOf<MappingException>()); }
public void WhenRegisteredAsComponetThenCantRegisterAsSubclass() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsComponent(typeof (MyComponent)); Executing.This(() => { inspector.AddAsTablePerClassHierarchyEntity(typeof (MyComponent)); inspector.IsTablePerClassHierarchy(typeof (MyComponent)); }).Should().Throw<MappingException>(); }
public void WhenRegisteredAsJoinedSubclassThenCantRegisterAsSubclass() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsRootEntity(typeof (MyClass)); inspector.AddAsTablePerClassEntity(typeof (Inherited1)); Executing.This(() => { inspector.AddAsTablePerClassHierarchyEntity(typeof (Inherited1)); inspector.IsTablePerClass(typeof (Inherited1)); }).Should().Throw<MappingException>(); }
public void WhenRegisteredAsJoinedSubclassThenCantRegisterAsSubclass() { var inspector = new ExplicitlyDeclaredModel(); inspector.AddAsRootEntity(typeof (MyClass)); inspector.AddAsTablePerClassEntity(typeof (Inherited1)); Assert.That(() => { inspector.AddAsTablePerClassHierarchyEntity(typeof (Inherited1)); inspector.IsTablePerClass(typeof (Inherited1)); }, Throws.TypeOf<MappingException>()); }
void IModelExplicitDeclarationsHolder.AddAsTablePerClassHierarchyEntity(System.Type type) { declaredModel.AddAsTablePerClassHierarchyEntity(type); }