public void TestCanAddItem()
		{
			ProjectNode projectNode = new ProjectNode(vsSolution, project.GUID);
			string itemName = "item1.cs";
			Assert.IsTrue(projectNode.CanAddItem(itemName));
			string invalidItemName = "<item1>.cs";
			Assert.IsFalse(projectNode.CanAddItem(invalidItemName));
		}
        public void TestCanAddItem()
        {
            ProjectNode projectNode = new ProjectNode(vsSolution, project.GUID);
            string      itemName    = "item1.cs";

            Assert.IsTrue(projectNode.CanAddItem(itemName));
            string invalidItemName = "<item1>.cs";

            Assert.IsFalse(projectNode.CanAddItem(invalidItemName));
        }
Esempio n. 3
0
        /// <summary>
        /// Determines whether the specified artifact link is valid.
        /// </summary>
        /// <param name="artifactLink">The artifact link.</param>
        /// <returns>
        ///     <c>true</c> if the specified artifact link is valid; otherwise, <c>false</c>.
        /// </returns>
        public bool IsValid(IArtifactLink artifactLink)
        {
            if (artifactLink == null ||
                string.IsNullOrWhiteSpace(artifactLink.ItemPath))
            {
                return(false);
            }

            IVsSolution  vsSolution       = GetService <IVsSolution, SVsSolution>();
            IVsHierarchy projectHierarchy = null;
            Guid         container        = artifactLink.Container;
            int          hr = vsSolution.GetProjectOfGuid(ref container, out projectHierarchy);

            if (hr == VSConstants.S_OK && projectHierarchy is IVsProject)
            {
                using (ProjectNode projectNode = new ProjectNode(vsSolution, artifactLink.Container))
                {
                    return(projectNode.CanAddItem(artifactLink.ItemPath));
                }
            }
            return(false);
        }