Mystery novels have a sub genre, the impossible crime or locked room mystery. These are, in effect, literary magic tricks, but with an explanation at the end (the very first modern mystery story falls into this category, Edgar Allan Poe's The Murders in the Rue Morgue).
Some of these (e.g., Clayton Rawson's stories) do involve magicians, but the majority do not. One of the best, The Rim of the Pit by Hake Talbot, was written by a magician -- Henning Nelms -- under another name.
The master of this entire genre is John Dickson Carr (try his The Three Coffins).
For a magician, I've found these books to be more interesting than the majority of mysteries involving magicians because they use magical principles to fool the reader. With some notable exceptions, most mysteries that have a magician as a character I've found to be uninteresting because the writer is simply adding an interesting character and the writer has no knowledge of how magic and magicians actually "work."
If you want to be pathological about this, try and get a copy of Locked Room Murders by Robert Adey, Crossover Press 1991, ISBN 0-9628870-0-5.
In the first part of the book, Adey lists 2019 locked room/impossible crime mysteries and states the "effect" (e.g., a drowned corpse falls through the skylight of a London studio, moments after the man was seen falling off a cruise ship in the English Channel).
In the second part, he repeats the list with the "method" explained and summarizes all of the methods into 20 categories.