示例#1
0
        public void WhenNewTabIsMoved_UpdatePaths()
        {
            var models = new[]
            {
                new TabModel(@"c:\Directory1\1.txt"),
                new TabModel(@"c:\Directory1\2.txt"),
                new TabModel(@"c:\Directory2\1.txt"),
            };

            var resolver = new DisplayPathResolver
            {
                models[0],
                models[1],
                models[2],
            };

            Assert.AreEqual(@"c:\Directory1", models[0].DisplayPath);
            Assert.AreEqual(null, models[1].DisplayPath);
            Assert.AreEqual(@"c:\Directory2", models[2].DisplayPath);

            models[2].FullPath = @"c:\Directory3\1.txt";

            Assert.AreEqual(@"c:\Directory1", models[0].DisplayPath);
            Assert.AreEqual(null, models[1].DisplayPath);
            Assert.AreEqual(@"c:\Directory3", models[2].DisplayPath);
        }
        public void WhenDuplicatesInSameNamedDirectories_ShowPathsEndWithMultipleDirectory()
        {
            var models = new[]
            {
                new TabModel(@"c:\Solution\Project1\SubDirectory1\1.txt"),
                new TabModel(@"c:\Solution\Project2\SubDirectory1\1.txt"),
            };

            var resolver = new DisplayPathResolver(@"c:\Solution")
            {
                models[0],
                models[1],
            };

            Assert.AreEqual(@"Project1\SubDirectory1", models[0].DisplayPath);
            Assert.AreEqual(@"Project2\SubDirectory1", models[1].DisplayPath);
        }
        public void WhenDuplicatesInVeryDeepSiblingDirectories_ShowPathsWithSingleEllipsis()
        {
            var models = new[]
            {
                new TabModel(@"c:\Solution\Project\very\deep\Directory1\1.txt"),
                new TabModel(@"c:\Solution\Project\very\deep\Directory2\1.txt"),
            };

            var resolver = new DisplayPathResolver(@"c:\Solution")
            {
                models[0],
                models[1],
            };

            Assert.AreEqual(@"…\Directory1", models[0].DisplayPath);
            Assert.AreEqual(@"…\Directory2", models[1].DisplayPath);
        }
        public void WhenOneDuplicateAtSolutionRoot_ShowDotPath()
        {
            var models = new[]
            {
                new TabModel(@"c:\Solution\Project1\1.txt"),
                new TabModel(@"c:\Solution\1.txt"),
            };

            var resolver = new DisplayPathResolver(@"c:\Solution")
            {
                models[0],
                models[1],
            };

            Assert.AreEqual(@"Project1", models[0].DisplayPath);
            Assert.AreEqual(@".\", models[1].DisplayPath);
        }
        public void WhenOneDuplicateOutsideSolutionRoot_ShowPathWithDriveLetter()
        {
            var models = new[]
            {
                new TabModel(@"c:\Solution\Project1\SubDirectory1\1.txt"),
                new TabModel(@"c:\Other\SubDirectory1\1.txt"),
            };

            var resolver = new DisplayPathResolver(@"c:\Solution")
            {
                models[0],
                models[1],
            };

            Assert.AreEqual(@"…\SubDirectory1", models[0].DisplayPath);
            Assert.AreEqual(@"c:\…\SubDirectory1", models[1].DisplayPath);
        }
示例#6
0
        public void WhenDuplicatesInNonSiblingDirectories_ShowPathsEndWithSingleDirectory()
        {
            var models = new[]
            {
                new TabModel(@"c:\root\Directory1\1.txt"),
                new TabModel(@"c:\root\1.txt"),
            };

            var resolver = new DisplayPathResolver
            {
                models[0],
                models[1],
            };

            Assert.AreEqual(@"c:\…\Directory1", models[0].DisplayPath);
            Assert.AreEqual(@"c:\root", models[1].DisplayPath);
        }
示例#7
0
        public void WhenDuplicatesInDeepSiblingDirectories_ShowPathsWithEllipsis()
        {
            var models = new[]
            {
                new TabModel(@"c:\root\Directory1\1.txt"),
                new TabModel(@"c:\root\Directory2\1.txt"),
            };

            var resolver = new DisplayPathResolver
            {
                models[0],
                models[1],
            };

            Assert.AreEqual(@"c:\…\Directory1", models[0].DisplayPath);
            Assert.AreEqual(@"c:\…\Directory2", models[1].DisplayPath);
        }
示例#8
0
        public void WhenDuplicatesInSameNamedDirectories_ShowPathsEndWithMultipleDirectory()
        {
            var models = new[]
            {
                new TabModel(@"c:\root\Directory1\SubDirectory1\1.txt"),
                new TabModel(@"c:\root\Directory2\SubDirectory1\1.txt"),
            };

            var resolver = new DisplayPathResolver
            {
                models[0],
                models[1],
            };

            // TODO: VSCode has better display: c:\…\Directory1\…
            Assert.AreEqual(@"c:\…\Directory1\SubDirectory1", models[0].DisplayPath);
            Assert.AreEqual(@"c:\…\Directory2\SubDirectory1", models[1].DisplayPath);
        }
        public void WhenDuplicateFileNames_ShowPaths()
        {
            var models = new[]
            {
                new TabModel(@"c:\Solution\Directory1\1.txt"),
                new TabModel(@"c:\Solution\Directory1\2.txt"),
                new TabModel(@"c:\Solution\Directory2\1.txt"),
            };

            var resolver = new DisplayPathResolver(@"c:\Solution")
            {
                models[0],
                models[1],
                models[2],
            };

            Assert.AreEqual(@"Directory1", models[0].DisplayPath);
            Assert.AreEqual(null, models[1].DisplayPath);
            Assert.AreEqual(@"Directory2", models[2].DisplayPath);
        }
示例#10
0
        public void WhenDuplicatesHaveSamePaths_ShowPaths()
        {
            var models = new[]
            {
                new TabModel(@"c:\root\Directory1\1.txt"),
                new TabModel(@"c:\root\Directory1\1.txt"),
                new TabModel(@"c:\Root\Directory2\1.txt"),
            };

            var resolver = new DisplayPathResolver
            {
                models[0],
                models[1],
                models[2],
            };

            Assert.AreEqual(@"c:\…\Directory1", models[0].DisplayPath);
            Assert.AreEqual(@"c:\…\Directory1", models[1].DisplayPath);
            Assert.AreEqual(@"c:\…\Directory2", models[2].DisplayPath);
        }
示例#11
0
        public void WhenDuplicateFullPaths_DoNotShowPaths()
        {
            var models = new[]
            {
                new TabModel(@"c:\root\Directory1\1.txt"),
                new TabModel(@"c:\root\Directory1\1.txt"),
                new TabModel(@"c:\Root\Directory1\1.txt"),
            };

            var resolver = new DisplayPathResolver
            {
                models[0],
                models[1],
                models[2],
            };

            Assert.AreEqual(null, models[0].DisplayPath);
            Assert.AreEqual(null, models[1].DisplayPath);
            Assert.AreEqual(null, models[2].DisplayPath);
        }
        public void WhenSolutionIsChanged_UpdatePaths()
        {
            var models = new[]
            {
                new TabModel(@"c:\Solution1\Project1\1.txt"),
                new TabModel(@"c:\Solution2\Project2\1.txt"),
            };

            var resolver = new DisplayPathResolver(@"c:\Solution1")
            {
                models[0],
                models[1],
            };

            Assert.AreEqual(@"Project1", models[0].DisplayPath);
            Assert.AreEqual(@"c:\…\Project2", models[1].DisplayPath);

            resolver.SolutionRootPath = @"c:\Solution2";

            Assert.AreEqual(@"c:\…\Project1", models[0].DisplayPath);
            Assert.AreEqual(@"Project2", models[1].DisplayPath);
        }