Characterization Of A Single Photon Sensing And Photon Number Resolving Cmos Detector For Astrophysics