public void ShouldNotFindNonSolutionFileIfExistInProjectFileWithDifferentCasing()
        {
            var solutionPath = RandomString.Make();
            var projectPath = RandomString.Make();
            var filesInProjectFile = new[] { "someThing"};
            var nonSolutionFile = "SOMETHING";

            var projectsInSolution = new ProjectsInSolutionStub(new[] { projectPath });
            var filesInProject = new FilesInProjectStub(filesInProjectFile);
            var filesOnDisk = new FilesOnDiskStub(filesInProjectFile.Union(new[] { nonSolutionFile }));

            var target = new FindNonSolutionFiles(filesOnDisk, filesInProject, projectsInSolution);
            var result = target.Find(solutionPath, Enumerable.Empty<string>());

            result.Should().Be.Empty();
        }
        public void ShouldSkipNonSolutionFileIfExcludeMatch()
        {
            var solutionPath = RandomString.Make();
            var projectPath = RandomString.Make();
            var filesInProjectFile = new[] { RandomString.Make(), RandomString.Make() };
            var nonSolutionFile = @"c:\something\me.txt";

            var projectsInSolution = new ProjectsInSolutionStub(new[] { projectPath });
            var filesInProject = new FilesInProjectStub(filesInProjectFile);
            var filesOnDisk = new FilesOnDiskStub(filesInProjectFile.Union(new[] { nonSolutionFile }));

            var target = new FindNonSolutionFiles(filesOnDisk, filesInProject, projectsInSolution);
            var result = target.Find(solutionPath, new[] {"something"});

            result.Should().Be.Empty();
        }
        public void ShouldFindNonSolutionFileIfNoExcludeMatch()
        {
            var solutionPath = RandomString.Make();
            var projectPath = RandomString.Make();
            var filesInProjectFile = new[] { RandomString.Make(), RandomString.Make() };
            var nonSolutionFile = RandomString.Make();

            var projectsInSolution = new ProjectsInSolutionStub(new[] { projectPath });
            var filesInProject = new FilesInProjectStub(filesInProjectFile);
            var filesOnDisk = new FilesOnDiskStub(filesInProjectFile.Union(new[] { nonSolutionFile }));

            var target = new FindNonSolutionFiles(filesOnDisk, filesInProject, projectsInSolution);
            var result = target.Find(solutionPath, new[] {RandomString.Make(), RandomString.Make()});

            result.Should().Have.SameValuesAs(nonSolutionFile);
        }
예제 #4
0
        public void UnionTest()
        {
            //ARRANGE
            var list1 = new[] { "a", "aa", "aaa" };
            var list2 = new[] { "dd", "eee", "ffff" };

            //ACT
            var union = list1.Union(list2, x => x.Length).ToList();

            //ASSERT
            CollectionAssert.AreEqual(new[] { "a", "aa", "aaa", "ffff" }, union);
        }