refactored escape character unit tests

 to include proper assertions for UTF16 values. Also added checks for validity of TextNode where it is needed