On the 22nd April 1862 Joe Johnston famously wrote "No-one but McClellan could have hesitated to attack." (ref). This quote is widely used in many general history books but as far as I can tell no-one has ever looked at what Johnston and McClellan actually thought the force balance was.
The Confederates believed McClellan had 200,000 men(ref), whereas when he contacted the Confederate works he had 45,000 PFD (ca. 30,000 effective infantry, plus supporting arms).
McClellan believed that the Confederate position was 18,000 or 20,000 strong, reinforced to 30,000 on the 7th (ref, and next page) and that his total force, including that not up yet was 68,000 PFD.
Earl J. Hess in his Field Armies and Fortifications of the Civil War, the Eastern Campaigns 1861-4 calls the Yorktown entrenchments "one of the strongest defensive positions of the war." (ref). Thus the combat power of Magruders, later Johnstons force is magnified many times.
Johnston's comment of the 22nd April is based upon the false notion that McClellan had over 10 to 1 supremacy in numbers when he contacted the Warwick Line. In fact it was closer to 3:2. When McClellan's entire command was up it numbered roughly 72,000 present (plus another division afloat after the 16th April), and thus maybe 60,000 effectives of all arms. Johnston had 55,000 effectives of all arms in the entrenchments and in reserve at Williamsburg. Thus there is rough numerical parity. To be fair, we should point out that towards the end McClellan received intelligence that Lee was reinforcing Johnston to 80,000 (ref), although it should be pointed out that this is an entirely reasonable "aggregate present" figure, and that according to Livermore the aggregate present and absent of Johnston's command is around 125,000 (Numbers and Losses, p43-4).
There certainly may have been an opportunity for assault. Beattie's coverage of events here is excellent (Army of the Potomac vol. 3, chapter 16). McClellan's army stepped off on the 5th April with orders to roll over the Yorktown position, but rain slowed the march, the rivers swelled and when they arrived the position was completely dominated by Confederate artillery. The Federals tried to assault twice anyway (although only reconnaisances in force, had either been successful the whole line was in place to attack), and McClellan didn't decide on a siege until 17th April (Beattie, chapter 21). It took two weeks to build irresistable siegeworks and the Confederates didn't wait to be on the receiving end of the bombardment.
In conclusion there is no reason to believe that McClellan was in the dark about what faced him, he just believed (IMHO, correctly) that the position was too strong, and tested this by several probes before settling down to blast it out. When half a century later generals ordered assaults on prepared positions with large fields of fire for crew served weapons we call them butchers and "donkeys", yet we deride a general who had learnt this lesson (from viewing the siege of Sebastapol) and declined the casual butchery in favour of actually winning.