public async Task PostAsyncTest() { //Backup accounts //This API will initiate a complete backup of all todo items in the TodoItemServer. The backup is asynchronous and the API will return the the id for the initiated backup. //Request: POST /backups //Request body: N/A //Response body: //``` //{ // “backupId”: < backupId > //} //``` // Arrange IBackupService backupService = new StubIBackupService() { InitiateAsync = () => { // Generate a random id var generator = new Random(); var id = 0; lock (generator) { id = (new Random()).Next(1, int.MaxValue); } return(Task.FromResult(id)); } }; BackupsController target = new BackupsController(backupService) { Request = new HttpRequestMessage() { Method = HttpMethod.Post, Properties = { { HttpPropertyKeys.HttpConfigurationKey, new HttpConfiguration() } } } }; // Act dynamic actual = await target.PostAsync(); Assert.IsNotNull(actual); dynamic status = actual.Content; Assert.IsNotNull(status); Assert.IsTrue(0 < status.BackupId); }