Completed ApiTest.cs. Backported some changes.

Backported some changes from the snapshot changes.