Add unit test and wiki documentation. re #6922

Also removed compiler errors
Merge branch 'feature/6922_mcstas' into develop