It goes like this, if you are told that a company you are interviewing with wants you to take a live coding test then you should tell them "I don't take live coding tests but if you wish to divine if my engineering skill is on the level of those in your team, I can give you a sample of code I've written and if you can't tell the engineering context and use for that code by inspecting it, I will have achieved necessary credits to be invalidated from taking the live coding exercise."
The reason this reverse test is valid is the premise of what is really being interviewed for when hiring software developers. It is not knowledge in real time of any given programming data structures or algorithms it is more about eventual ability to wield such structures to solves difficult application problems. That is what engineering is all about, completion time is only important on long scales not down to the minute scales for such solutions.
So if the context of those larger problems can be inferred from the code it usually indicates a very atomic solution (one that runs on a single machine or doesn't span a complex and dynamic execution environment that is networked) this is really the EASY type of crap that is often tested for in live coding exercises but tells nothing about *engineering* which tends to invisibly span across different bits of code and brings to life the efficiency of a distributed solution.
So I'd challenge my interlocutor to decipher the engineering purpose of a bit of my code...at method level show a class implementation and ask what it does globally? Or a bit easier depending on your POV show them an entire class and let them infer how the larger system uses it simply from that class code alone. If they can do that from the code in one of my projects then they have demonstrated exceeding me in the engineering ability that THEY should be looking for without needing to do any further testing and I'd acquiesce and remove my candidacy for their position.
If they continue to harp that the "live coding test" is mandatory and can't be substituted then they've demonstrated that they are not looking for engineers properly and likely have a set of unskilled programmers that I would not find it very fun to work with in the first place and thus remove my interest on those grounds...win, win.
I haven't used this tactic yet on an interview but I am thinking of doing it the next time I am asked to participate in a live coding exercise.