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); } }
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>(); }
private static void AssertCommonPathFound(string expected, params string[] paths) { var findCommonPath = FileSystemHelpers.FindCommonPath(paths); findCommonPath.Should().Be(expected); }