The Hartmann wavefront sensor is able to measure, separately and in absolute, the real δ and imaginary parts β of the X-ray refractive index. While combined with tomographic setup, Hartmann sensor opens many interesting opportunities behind the direct measurement of the material density. In order to handle the different ways of using an X-ray wavefront sensor in imaging, we developed 3D wave propagation model based on Fresnel propagator. The model is made in a way to manage any degree of spatial coherence of the source, thus enabling to model accurately experiments using tabletop source, high harmonic generation, plasma-based soft X-ray laser, synchrotron or X-ray free-electron laser. Beam divergence is described in a physical manner consistent with the spatial coherence.The capabilities of the Hartmann wavefront sensor will be compared with experimental results from in-line X-ray Phase Contrast Tomography.