public void AllowedDependencies() { EntityRelationshipManager.AddAllowedDependency( typeof(EntityMocks.EntityMock1), typeof(EntityMocks.EntityMock2)); Assert.IsTrue( EntityRelationshipManager.GetIsDependencyAllowed( typeof(EntityMocks.EntityMock1), typeof(EntityMocks.EntityMock2))); Assert.IsFalse( EntityRelationshipManager.GetIsDependencyAllowed( typeof(EntityMocks.EntityMock2), typeof(EntityMocks.EntityMock1))); }
//------------------------------------------------------------------------- private void PopulateDependencies() { try { uiDependencies.Items.Clear(); // Iterate through all the entity types. foreach (Type type in EntityTypes.Values) { // Is the entity is allowed to depend on this type? bool dependencyAllowed = EntityRelationshipManager.GetIsDependencyAllowed( Entity.GetType(), type); if (dependencyAllowed) { // Get all the entities of the type (which we now know // the entity is allowed to depend on) and add to the UI list. ReadOnlyDictionary <int, Entity> entities; Roadmap.GetEntities(type, out entities); foreach (Entity e in entities.Values) { // Can't depend on itself. if (e != Entity) { uiDependencies.Items.Add( e, Entity.GetIsDependantOn(e)); } } } } } catch (Exception ex) { Program.HandleException(ex); } }