private static void AssertCommonPathFound(string result, params string[] paths)
        {
            var findCommonPath = FileSystemHelpers.FindCommonPath(paths);

            if (result == null)
            {
                findCommonPath.Should().BeNull();
            }
            else
            {
                findCommonPath.Should().Be(result);
            }
        }
Exemplo n.º 2
0
        public void CommonParentTest()
        {
            var environment = new DefaultEnvironment();

            environment.FileSystem = new FileSystem(TestRepoMasterDirtyUnsynchronized);

            var ret = FileSystemHelpers.FindCommonPath(new string[]
            {
                "Assets/Test/Path/file",
                "Assets/Test/something",
                "Assets/Test/Path/another",
                "Assets/alkshdsd",
                "Assets/Test/sometkjh",
            });

            Assert.AreEqual("Assets", ret);
        }
        public void ShouldNotErrorIfEmpty()
        {
            Action item;

            item = () => { FileSystemHelpers.FindCommonPath(new List <string>()); };
            item.ShouldNotThrow <InvalidOperationException>();

            item = () => { FileSystemHelpers.FindCommonPath(new List <string> {
                    null
                }); };
            item.ShouldNotThrow <InvalidOperationException>();

            item = () => { FileSystemHelpers.FindCommonPath(new List <string> {
                    ""
                }); };
            item.ShouldNotThrow <InvalidOperationException>();
        }
Exemplo n.º 4
0
        private static void AssertCommonPathFound(string expected, params string[] paths)
        {
            var findCommonPath = FileSystemHelpers.FindCommonPath(paths);

            findCommonPath.Should().Be(expected);
        }