Example #1
0
        public void CheckProjectReferenceDuplicates_NoProjectDuplicates_ReturnsEmptyString()
        {
            var filesRunnerMock = new Mock <IProjectFilesRunner>();

            filesRunnerMock.Setup(fr => fr.CollectComplaintsForFiles(It.IsAny <Func <string, IEnumerable <string> > >()))
            .Returns((Func <string, IEnumerable <string> > func) => string.Join("\n", func(@"../../../TestProjectFiles/Dg.Component.xml")));
            var checker = new ReferenceDuplicatesChecker(new CsprojReferencesExtractor(), filesRunnerMock.Object);

            var complaints = checker.CheckProjectReferenceDuplicates();

            Assert.Empty(complaints);
        }
Example #2
0
        public void CheckProjectReferenceDuplicates_1ProjectDuplicate_Returns1Complaint()
        {
            var filesRunnerMock = new Mock <IProjectFilesRunner>();

            filesRunnerMock.Setup(fr => fr.CollectComplaintsForFiles(It.IsAny <Func <string, IEnumerable <string> > >()))
            .Returns((Func <string, IEnumerable <string> > func) => string.Join("\n", func(@"../../../TestProjectFiles/Duplicates.xml")));
            var checker = new ReferenceDuplicatesChecker(new CsprojReferencesExtractor(), filesRunnerMock.Object);

            var complaints = checker.CheckProjectReferenceDuplicates();

            Assert.NotEmpty(complaints);
            Assert.Equal(@"There is a duplicate ProjectReference Dg.Component.Contracts in ../../../TestProjectFiles/Duplicates.xml. Please clean this up!", complaints);
        }