The general consensus is that the Republican debate hosted last night by CNBC was a train wreck.

And yeah, it kind of was a train wreck. The Federalist‘s Mollie Hemingway had warned that CNBC was choosing for their moderator a total pro-Hillary hack, John Harwood. Boy, did that turn out to be right. He and the other moderators asked hostile questions with leading assumptions and poorly researched “facts,” injecting themselves into the debate. In an early back-and-forth with Donald Trump about taxes, Harwood even got the last word in the exchange, as if he were one of the participants rather than the moderator.

Instead of being a chance for the Republican candidates to debate each other, the CNBC debate ended up pitting the candidates in a debate against the mainstream media.

And that’s what was awesome about it.

A presidential primary is not just an opportunity for candidates to stand around giving their policy positions or telling us the heartwarming and inspirational stories of their upbringing. It’s about putting them to the test and seeing if they can handle some of the real challenges of the job. Can they think on their feet and keep their cool? Can they make a personal connection with the average American? Can they handle stress and make decisions on the fly?

Last but not least—can they deliver a smackdown to the lamestream media?

Someone once compared presidential contests to crash test dummies.

Someone once compared presidential contests to crash test dummy simulations: it is a series of artificially induced crises intended to show how the candidates will deal with a real crisis. And if we want to test out the candidates in real-world conditions—well, what’s more realistic than figuring out how they deal with a biased, hostile media? Anybody remember moderator Candy Crowley weighing in on Barack Obama’s side during one of the debates with Mitt Romney in 2012? That’s exactly what a Republican candidate can expect in the general election. And it’s certainly what he (or she) can expect while in office. A hostile media is the air a Republican politician is required to breathe, so it’s good to have a nice, strong test to see who chokes and who can handle it.

The debate was a fiasco, but it was a useful fiasco.

Rather than writing off last night’s debate purely as a fiasco, I view it as a useful fiasco. We should have one debate like it during every primary cycle.

If we look at it from this perspective, it helps us figure out who really won last night’s debate. The winners are those who showed us they know how to give the backs of their hands to the press, and do it with style. I see two winners and two losers.

The award for Tearing The Mainstream Media A New One goes to Ted Cruz, for this outraged response to the moderators.

Here’s the key section:

You know, let me say something at the outset. The questions that have been asked so far in this debate illustrate why the American people don’t trust the media. This is not a cage match. And, you look at the questions—”Donald Trump, are you a comic-book villain?” “Ben Carson, can you do math?” “John Kasich, will you insult two people over here?” “Marco Rubio, why don’t you resign?” “Jeb Bush, why have your numbers fallen?” How about talking about the substantive issues the people care about?

The award for Carpet-Bombing The Enemy From 30,000 Feet goes to Marco Rubio, who refused to take the bait to attack Donald Trump and instead described the mainstream media as “the ultimate Super PAC” for Hillary Clinton.

What Rubio said was pretty similar to what Cruz said, but what differentiates him is the style in which he says it, which seems smoother, less combative, and more above it all. He criticizes the media, but from a higher plane.

The award for Getting Used By The Mainstream Media To Attack Other Republicans goes to John Kasich. When pushing back against Donald Trump and Ben Carson on their tax plans, John Harwood called in Kasich with this unbelievable softball of a question: “You had some very strong words to say yesterday about what’s happening in your party and what you’re hearing from the two gentlemen we’ve just heard from. Would you repeat it?” CNBC has been going around today telling everyone that their moderators asked the candidates “tough questions.” Tough questions like “could you repeat your criticisms of Republicans?” And Kasich just went with it.

I would say that this is going to hurt him in the polls, except that there’s not much to hurt. He’s a margin of error candidate, languishing somewhere between 2% and 4% in the polls.

Trump lost because we’re all talking about CNBC and not about him.

Finally, the award for Getting Lost In The Commotion goes to Donald Trump. For all his supposed savvy at manipulating the contemporary media environment, we’re all talking about CNBC today and not talking about him. That’s a big problem as he fades to second place in the national polls and needs to maintain his media dominance.

All in all, these are some very useful results.

Was the debate a train wreck? Well, modern American politics are a train wreck. Might as well search for a candidate who knows how to make his way through it.

Follow Robert on Twitter.