public void ToStringFormatsOutputCorrectly()
		{
			Guid projectGuid = Guid.NewGuid();
			Collection<Role> roles = new Collection<Role>();
			roles.Add(new Role("foo"));
			roles.Add(new Role("bar"));

            Config.ProjectMappingEntry mapping = new Config.ProjectMappingEntry(projectGuid, "\\", roles, "FooName");

			Assert.AreEqual("{" + projectGuid.ToString() + "} -> foo,bar", mapping.ToString());
		}
        public void ToStringFormatsOutputCorrectly()
        {
            Guid projectGuid        = Guid.NewGuid();
            Collection <Role> roles = new Collection <Role>();

            roles.Add(new Role("foo"));
            roles.Add(new Role("bar"));

            Config.ProjectMappingEntry mapping = new Config.ProjectMappingEntry(projectGuid, "\\", roles, "FooName");

            Assert.AreEqual("{" + projectGuid.ToString() + "} -> foo,bar", mapping.ToString());
        }
		public void FindRoleByNameReturnsNullWhenRollNotPresent()
		{
			Guid projectGuid = Guid.NewGuid();
			Collection<Role> roles = new Collection<Role>();
			roles.Add(new Role("foo"));
			roles.Add(new Role("bar"));

            Config.ProjectMappingEntry mapping = new Config.ProjectMappingEntry(projectGuid, "\\", roles, "FooName");

			Role result = mapping.FindRoleByName("baz");

			Assert.IsNull(result, "No role should be returned");
		}
		public void FindRoleByNameReturnsRoleWhenPresent()
		{
			string roleToFind = "foo";
			Guid projectGuid = Guid.NewGuid();
			Collection<Role> roles = new Collection<Role>();
			roles.Add(new Role(roleToFind));
			roles.Add(new Role("bar"));
            Config.ProjectMappingEntry mapping = new Config.ProjectMappingEntry(projectGuid, "\\", roles, "FooName");

			Role result = mapping.FindRoleByName(roleToFind);

			Assert.IsNotNull(result, "No role returned when one should exist");
			Assert.AreEqual(roleToFind, result.Name, "Role name does not match role searched for");
		}
        public void FindRoleByNameReturnsNullWhenRollNotPresent()
        {
            Guid projectGuid        = Guid.NewGuid();
            Collection <Role> roles = new Collection <Role>();

            roles.Add(new Role("foo"));
            roles.Add(new Role("bar"));

            Config.ProjectMappingEntry mapping = new Config.ProjectMappingEntry(projectGuid, "\\", roles, "FooName");

            Role result = mapping.FindRoleByName("baz");

            Assert.IsNull(result, "No role should be returned");
        }
        public void FindRoleByNameReturnsRoleWhenPresent()
        {
            string            roleToFind  = "foo";
            Guid              projectGuid = Guid.NewGuid();
            Collection <Role> roles       = new Collection <Role>();

            roles.Add(new Role(roleToFind));
            roles.Add(new Role("bar"));
            Config.ProjectMappingEntry mapping = new Config.ProjectMappingEntry(projectGuid, "\\", roles, "FooName");

            Role result = mapping.FindRoleByName(roleToFind);

            Assert.IsNotNull(result, "No role returned when one should exist");
            Assert.AreEqual(roleToFind, result.Name, "Role name does not match role searched for");
        }
		private void TraverseHierarchyNode(HierarchyNode node)
		{
			node.RecursiveForEach(delegate(HierarchyNode child)
			{
				// recurse if this node is a Solution Folder
				if (child.TypeGuid != SolutionFolderGuid)
				{
					// If this is a project, add the mapping
					if (child.ExtObject is EnvDTE.Project)
					{
						Collection<Role> roles = GetRoles(child.ExtObject as Project);
						if (child.ProjectGuid != Guid.Empty)
						{
							ProjectMappingEntry mapping = new ProjectMappingEntry(child.ProjectGuid, ProjectPath, roles, child.Name);
                            manager.AddProjectMappingEntry(mappingTableName, mapping);
                            this.Trace(Resources.MappingTableAddedMessage, TraceEventType.Information, child.Name, mappingTableName, roles.Count); 
						}
					}
				}
			});
		}