In my recent paper on Historical Simulations, I noted that it would be possible for a future society around 2050 to run completely realistic simulations designed to test AI for ethical flaws. They could overcome the ethical problems associated with the Milgram Experiment by obtaining informed consent from the AI and then doing the appropriate memory wipe of the consent process.
Now we see that first step has been taken along the road towards this scenario. Researchers at University College in London have re-created the Milgram Experiment in virtual reality by requesting participants to administer electrical "shocks" to a simulated "subject". These researchers claim that the participants reacted as if the experiment were as real as the original 1961 experiment, despite the fact that they clearly knew that the individual to whom they were administering the "shocks" was merely virtual.
I expect that the results of this recent attempt to re-create the Milgram experiment will eventually be seen as somewhat feeble, given that the participants were obviously aware that they were just giving simulated shocks, which eliminates the deception necessary for the experiment to carry any weight. If someone is ordered to toss a Barbie doll over the edge of a cliff, it doesn't mean that they would likely do the same if ordered to do so to a live human being. Eventually, this dissatisfaction with the virtual Milgram Experiment will lead to impetus to conduct it, or something similar to it, with AI in a completely realistic simulation in which the AI is not aware that it is actually in a simulation. To avoid the ethical problems associated with the lack of informed consent, the appropriate memory wipe of the consent process would be used, as I outlined in my paper.