Really sad story. The professor, of course, should not have walked out, what should have happened instead he should have continued teaching (even if only one student remained in class) and then have as much as possible of these topics on the test. And when people that walked out failed the course they'd have to consider if they want to retake it, this time properly, of choose something else instead.