Critical fixes of the new caching architecture.
Added first completion unit tests. Related to aBothe/Mono-D#318