Move expected and scope_guard out of detail namespace