Exemple #1
0
        public void SuccessfullyRemoveContentFile_When_CsProjHasOtherContentElements()
        {
            IEnumerable <XElement> contentElementsBeforeRemove = _initialCsprojWithElements.Descendants().Where(x => x.Name.ToString().EndsWith(Constants.ContentElem));
            string firstContentElementIncludeValue             = contentElementsBeforeRemove.First().Attribute(Constants.IncludeAttribute).Value;

            FileModifierResult result = CsProjModifier.RemoveFiles(CsProjWithElementsPath, new List <string> {
                firstContentElementIncludeValue
            });

            Assert.IsTrue(result.Success);

            XDocument resultCsproj = XDocument.Load(CsProjWithElementsPath);
            IEnumerable <XElement> contentElementsAfterRemove = resultCsproj.Descendants().Where(x => x.Name.ToString().EndsWith(Constants.ContentElem));

            int contentElementsBeforeRemoveCount = contentElementsBeforeRemove.Count();
            int contentElementsAfterRemoveCount  = contentElementsAfterRemove.Count();

            Assert.AreNotEqual(contentElementsAfterRemoveCount, contentElementsBeforeRemoveCount);
        }
Exemple #2
0
        /// <summary>
        /// Removes files from the csproj file
        /// </summary>
        protected void RemoveFilesFromCsproj()
        {
            string csProjFilePath = GetCsprojFilePath();

            CsProjModifier.RemoveFiles(csProjFilePath, this.createdFiles);
        }