Generalize PathBase logic

Some of the original path base logic in TestHost was too specific. For base addresses with an empty path it ensured that the `/` was part of the Path, not PathBase.  However it didn't correctly handle `/PathBase/` ending in a `/`, which needs to be stripped off for StartsWithSegments to work.

@Praburaj @muratg 
Syntax nit: bellow -> below