The daughter of my old boss at Sandoz (now Novartis) worked for the Swiss Commission that looked into Swiss behaviour and policy during the Second World War. The myth had long been that plucky little Switzerland was a formidable hedgehog that the Nazis didn't dare tackle. That they were ready for invasion can be seen by the pillboxes and rows of dragons' teeth that march across Swiss fields to this day.
The Commission's studies revealed a much more complex and ambivalent picture. It seems that the Nazis decided that the existence of Switzerland was more useful to them than its occupation. And, regrettably, plenty of Swiss were prepared to take advantage of the situation, from the bankers who made hay (refusing to pay up because the descendants of people who perished in Auschwitz couldn't produce death notices) to the German subsidiaries of Swiss companies which happily used slave labour.
As a small neutral, democratic country surrounded by large, unfriendly neighbours, Switzerland had to play its cards very carefully. It even played along with the Gestapo in stopping Jews escaping, punishing the few heroes who helped:
http://www.yadvashem.org/yv/en/righteous/stories/grueninger.asp
The only time that Germany contemplated invasion was when Italy surrendered, and the Germans wanted to secure their lines of communication. The Swiss got wind of it and Swiss General Guisan (the Swiss Army only has a general in time of war, appointed by Parliament) met a German general quietly and told him that not only would the Swiss resist, but the first thing they'd do was blow the Gotthard Tunnel. End of invasion plans.