The Night King has been marching his undead armies towards the wall for quite some time. They start off well before there is any inkling that Dany will come with her dragons to rescue 'Jon' et. al.
At the start of their march, it seems like they are going all the way to the wall, even though it will prevent them from passing into the North of Westeros. The whole time they are marching we, the viewers, are wondering how they will overcome this obstacle.
Then, just before they arrive at the Wall, we get our answer - they kill and turn Viserion the dragon, who can destroy a section of the wall to allow their passage.
My question(s) is/are: should we assume the Night King knew he would be able to capture Viserion? We've had hints that Bran's powers extend to prophecy, and there are obviously a lot of parallels between the Night King's powers and those of the Three Eyed Raven. If he didn't anticipate turning a dragon, aren't we told passing the enchanted Wall would be impossible for the armies of the dead?