public void SuperClass() { this.Explorer.AddRepository(this.Repository); var person = this.domain.AddDeclaredObjectType(Guid.NewGuid()); person.SingularName = "Person"; person.PluralName = "Persons"; var employee = this.domain.AddDeclaredObjectType(Guid.NewGuid()); employee.SingularName = "Employee"; employee.PluralName = "Employees"; employee.IsAbstract = true; var adressable = this.domain.AddDeclaredObjectType(Guid.NewGuid()); adressable.SingularName = "Adressable"; adressable.PluralName = "Adressable"; adressable.IsAbstract = true; person.SendChangedEvent(); employee.SendChangedEvent(); adressable.SendChangedEvent(); this.domain.SendChangedEvent(); this.TreeViewTester.SelectNode(this.TreeViewTester.FindNode(0, 0, 0, 2)); var testPropertyGrid = new PropertyGridTester("testPropertyGrid"); var superClassGridItem = testPropertyGrid.FindGridItem("Superclass"); Assert.AreEqual(null, superClassGridItem.Value); var typeDecorator = (ObjectTypeDecorator)testPropertyGrid.Target.SelectedObject; var editorMock = new EditorMock(typeDecorator); editorMock.EditorMockDropDown += SuperClassEditorMockDropDown; var superclassTypeEditorTypeEditor = new SuperclassTypeEditor(); var superClass = (ObjectType)superclassTypeEditorTypeEditor.EditValue(editorMock, editorMock, typeDecorator.Superclass); Assert.AreEqual(superClass, employee); superClassGridItem.Value = superClass; Assert.AreEqual(superClass, person.DirectSuperclass); }
public void RelationType() { this.Explorer.AddRepository(this.Repository); var company = this.domain.AddDeclaredObjectType(Guid.NewGuid()); company.SingularName = "Company"; company.PluralName = "Companies"; var person = this.domain.AddDeclaredObjectType(Guid.NewGuid()); person.SingularName = "Person"; person.PluralName = "Persons"; company.SendChangedEvent(); person.SendChangedEvent(); var employeeRelationType = this.domain.AddDeclaredRelationType(Guid.NewGuid(), Guid.NewGuid(), Guid.NewGuid()); employeeRelationType.AssociationType.ObjectType = company; employeeRelationType.AssociationType.IsOne = true; employeeRelationType.AssociationType.AssignedSingularName = "Employer"; employeeRelationType.AssociationType.AssignedPluralName = "Employers"; employeeRelationType.RoleType.ObjectType = person; employeeRelationType.RoleType.IsMany = true; employeeRelationType.RoleType.AssignedSingularName = "Employee"; employeeRelationType.RoleType.AssignedPluralName = "Employees"; employeeRelationType.SendChangedEvent(); this.domain.SendChangedEvent(); this.TypeNode.Target.ExpandAll(); var relationNodeTesters = this.TypeNode.FindByTagType(typeof(RelationTypeTag)); var employeeNodeTester = relationNodeTesters[0]; this.TreeViewTester.SelectNode(employeeNodeTester); var testPropertyGrid = new PropertyGridTester("testPropertyGrid"); var relationDecorator = (RelationTypeDecorator)testPropertyGrid.Target.SelectedObject; var roleDecorator = relationDecorator.RoleType; var editorMock = new EditorMock(roleDecorator); editorMock.EditorMockDropDown += EditorMockEditorMockDropDown; var typeTypeEditor = new ObjectTypeTypeEditor(); typeTypeEditor.EditValue(editorMock, editorMock, roleDecorator.ObjectType); }
public void Interfaces() { this.testCaseSwitch = TestCaseSwitch.Interfaces; this.Explorer.AddRepository(this.Repository); var person = this.domain.AddDeclaredObjectType(Guid.NewGuid()); person.SingularName = "Person"; person.PluralName = "Persons"; var role = this.domain.AddDeclaredObjectType(Guid.NewGuid()); role.IsInterface = true; role.SingularName = "Role"; role.PluralName = "RoleTypes"; role.SendChangedEvent(); person.SendChangedEvent(); this.domain.SendChangedEvent(); // Muldec this.TreeViewTester.SelectNode(0, 0, 0, 0); var testPropertyGrid = new PropertyGridTester("testPropertyGrid"); var typeDecorator = (ObjectTypeDecorator)testPropertyGrid.Target.SelectedObject; var editorMock = new EditorMock(typeDecorator); var superinterfacesTypeEditor = new SuperinterfacesTypeEditor(); var interfaces = (ObjectType[]) superinterfacesTypeEditor.EditValue(editorMock, editorMock, typeDecorator.PossibleSuperinterfaces); typeDecorator.Superinterfaces = interfaces; Assert.AreEqual(1, interfaces.Length); Assert.AreEqual(role, interfaces[0]); Assert.AreEqual(1, person.DirectSuperinterfaces.Length); }