This is a classic and devious, yet ultimately innocent, yarn about deception and marriage. Shakespeare utilizes many of his classic plot devices (fear of cuckoldry, mistaken identity, etc). He draws upon, though never explicitly states, themes of “godly deception” found in the Old Testament. Legalists will not like this play.
Some critics, if Wikipedia is to believed, say Bertram’s actions, both in leaving the court (and ultimate reconciliation) are “forced” and not realistic. What many do not understand is that in the ancient world, if you consummated a marriage, you were bound to each other as one flesh. Bertram knew this. He knew that marrying but not having sexual intercourse with his bride allowed him an easy way out through annulment. That’s what makes the “reveal” at the end so perfect.
More on lying and deception: https://drmsh.com/lying-and-deception/