Splited code into testable and untestable and refactoring

Due to Pester's limitations, some functions are not possible
to mock (like static methods from C#). A wrapper was made for
such cases.