The method IsChildOf returns an invalid result in the following test-case:
parentDirectory = new String("D:/Foo").ToAbsoluteDirectoryPath();
m_PathString = new String("D:/Foo bar").ToAbsoluteDirectoryPath();
public bool IsChildOf(IDirectoryPath parentDirectory) {
Debug.Assert(parentDirectory != null);
string parentPathLowerCase = parentDirectory.ToString().ToLower();
string thisPathLowerCase = m_PathString.ToLower();
...
return thisPathLowerCase.IndexOf(parentPathLowerCase) == 0;
}
thisPathLowerCase.IndexOf(parentPathLowerCase) === 0 will result in true, but m_PathString is no child of parentDirectory.
The method IsChildOf returns an invalid result in the following test-case:
parentDirectory = new String("D:/Foo").ToAbsoluteDirectoryPath();m_PathString = new String("D:/Foo bar").ToAbsoluteDirectoryPath();thisPathLowerCase.IndexOf(parentPathLowerCase) === 0 will result in
true, butm_PathStringis no child ofparentDirectory.