private static async Task AlbumsControllerTest(HttpClient client)
{
// create album
await client.PostAsync("Albums/Create",
new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("title", "album 009") }));
await client.PostAsync("Albums/Create",
new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("title", "album 010") }));
// get all albums
Console.WriteLine(await client.GetStringAsync("Albums/All"));
// update album
await client.PutAsync("Albums/Update",
new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("id", "2"),
new KeyValuePair<string, string>("year", "2014"),
new KeyValuePair<string, string>("producer", "gosho ot pochivka")
}));
// delete album
await client.DeleteAsync("Albums/Delete/1");
// add song to album
await client.PutAsync("Albums/AddSong?albumId=2&songId=2", null);
// add artist to album
await client.PutAsync("Albums/AddArtist?albumId=2&artistId=2", null);
}