Reflection and refraction will always occur unless the angle of incidence is greater than the critical angle. Under this situation, only reflection occurs (hence the term, total internal reflection). The critical angle is defined as Theta_crit = arcsin(n_2 / n_1) where n_2 is the index of refraction of the medium the light is traveling into and n_1 is IoR of the medium the light is traveling from. Therefore, total internal reflection can only occur when traveling from a higher index of refraction material into a lower index of refraction material.