I found the async/await answer for the challenge I detail here and it looks like so:
[TestMethod]
public void test_controller()
{
var task = Whatever();
task.Wait();
string stuff = task.Result;
Assert.AreEqual(stuff,"I like cats!");
}
private async Task
{
var myModel = new MyModel();
var myController = new MyController();
HttpResponseMessage response = myController.Post(myModel);
Byte[] myBytes = await response.Content.ReadAsByteArrayAsync();
return System.Text.Encoding.Default.GetString(myBytes);
}
This is how one sniffs out a type. The type does not have to be a string.
No comments:
Post a Comment