Well, the answer can be found in one major battle between the French and the Swiss, fought at Marignano during the last stage of the War of the Holy League from 1508-1516.
The Swiss had enjoyed a long string of victories plundering and capturing much of Northern Italy, including Milan, a key access point for the rival French armies.
The French army, under their new and young King Francis, decided to surprise the Swiss by undertaking a dangerous march over a previously unused pass of the Alps and into the plains around Milan.
The outnumbered Swiss began to offer terms to the French royal army; that is until Swiss reinforcements showed up. The bolstered Swiss abandoned attempts to negotiate and prepared for battle.
The Swiss had about 22,000 men and faced a French army of close to 40,000 men with fearsome German Landsknechts, Lancers, and artillery. The Swiss weren’t too concerned about the lopsided numbers as they had won against similar odds only a few years ago at the battle of Novara.
On the eve of battle, Francis decided to arrange his dozens of field guns along the front lines in the center of his formation, with cavalry out wide on the flanks.
The Swiss massed into a large infantry formation as they had no cavalry or artillery to speak of. Their strategy was to charge straight at the cannons, take the position and turn the artillery around to fire back on the French. As bold as the move seems, such tactics had worked for them in the past.
The Swiss charge occurred just before sunset and was so rapid that the French artillery had trouble landing hits on the charging infantry. The Swiss captured some artillery and ran into fierce fights with the Landsknechts.
The two fighting units had been rivals competing for the title of the best combat unit in Europe, and they fought fiercely through the twilight. Charges by the French cavalry led by King Francis helped to finally push the Swiss back.
Many officers and nobles fought and died during the last frantic nighttime exchanges before both sides withdrew for the night.
The next day the order of battle was the same, and the Swiss tactics remained the same. The Swiss launched a massive charge at the cannons, but this time, the artillery crews were prepared.
The French shots ripped through the tight formations of the Swiss. Undaunted, the Swiss continued to charge and pushed right up to the line of cannons.
A fierce fight ensued with the Landsknechts, cavalry charges and point-blank cannon fire against the nearly unmovable mass of disciplined Swiss.
The battle was a gridlock until French-allied Venetian forces scrambled onto the battlefield. Their extra flanking attacks and manpower finally turned the tide and forced a Swiss retreat.
The sustained cannon fire, cavalry charges, and grueling fight cost the Swiss dearly. They likely lost more than half their men, compared to about 5,000 French casualties.
This resulted in an immediate peace with the French with long-term implications. The treaty had an “Eternal Peace” clause saying that neither France nor Switzerland would ever fight the other, and they would never ally with the others enemies.
This clause persisted for France until their revolution and was only impinged upon in Switzerland by the invading French. Swiss mercenaries still fought on occasion, but these occasions were few.
Over the centuries the stance on neutrality only became stronger, with laws eventually put in place to prevent Swiss citizens from fighting in foreign wars
The Swiss have largely been able to keep their neutrality (outside of the Napoleonic Era) because they have outstanding natural defenses. The mountain passes would be a tough obstacle for even a modern invading army. Also the policy of limited immigration and all The structure of the Swiss militia system stipulates that the soldiers keep their Army issued equipment, including all personal weapons, at home. Some organizations and political parties find this practice controversial but mainstream Swiss opinion is in favor of the system. Compulsory military service concerns all male Swiss citizens; women can serve voluntarily. Men usually receive military conscription orders for training at the age of 18. About two thirds of the young Swiss are found suited for service; for those found unsuited, various forms of alternative service exist. Annually, approximately 20,000 persons are trained in recruit centers for a duration from 18 to 21 weeks. The reform "Army XXI" was adopted by popular vote in 2003, it replaced the previous model "Army 95", reducing the effectives from 400,000 to about 200,000. Of those, 120,000 are active in periodic Army training and 80,000 are non-training reserves.
The Swiss are a rare example of a profoundly neutral country with the ability to stay that way for centuries.
I will also include a video of the Swiss Drum corp. They are not related to the Military but they are highly skilled.