public void IsInAllowedDir_ReturnsFalseIfConstaint_AndOutside() { var d = new DirectoryAdapter(new MapPathImpl(), true, _CurrDir); Assert.IsFalse(d.IsInAllowedDir("\\")); Assert.IsFalse(d.IsInAllowedDir("\\\\?\\C:\\")); Assert.IsFalse(d.IsInAllowedDir(@"\\.\dev0")); Assert.IsFalse(d.IsInAllowedDir(@"\\?\UNC\/")); }
public void IsInAllowedDir_ReturnsTrueForInside() { var d = new DirectoryAdapter(new MapPathImpl(), true, _CurrDir); Assert.IsTrue(d.IsInAllowedDir(_CurrDir)); Assert.IsTrue(d.IsInAllowedDir(_CurrDir.Combine("hej/something/test"))); Assert.IsTrue(d.IsInAllowedDir(_CurrDir.Combine("hej"))); Assert.IsTrue(d.IsInAllowedDir(_CurrDir.Combine("hej.txt"))); Assert.IsTrue(d.IsInAllowedDir("hej"), "It should return true for relative paths."); Assert.IsTrue(d.IsInAllowedDir("hej.txt"), "It should return true for relative paths"); }
public void IsInAllowedDirReturnsTrueIfNoConstraint() { var ad = new DirectoryAdapter(new MapPathImpl(), false, null); Assert.IsTrue(ad.IsInAllowedDir("\\")); }