コード例 #1
0
        public void CanGetCommonRootPath()
        {
            FilePath[] pathsWithCommon =
            {
                FilePath.Build("test", "common"),
                FilePath.Build("test", "common", "notcommon1"),
                FilePath.Build("test", "common", "notcommon1",  "notcommon11"),
                FilePath.Build("test", "common", "notcommon2"),
                FilePath.Build("test", "common", "notcommon3",  "notcommon31"),
            };
            Assert.AreEqual(FilePath.Build("test", "common"), FilePath.GetCommonRootPath(pathsWithCommon));

            FilePath[] justOnePath =
            {
                FilePath.Build("test", "common"),
            };
            Assert.AreEqual(FilePath.Build("test", "common"), FilePath.GetCommonRootPath(justOnePath));

            FilePath[] pathsNotCommon =
            {
                FilePath.Build("notcommon1"),
                FilePath.Build("notcommon2"),
                FilePath.Build("notcommon3"),
            };
            Assert.IsTrue(FilePath.GetCommonRootPath(pathsNotCommon).IsNullOrEmpty);
        }