public async Task DogAsync() { var stream = await _dogs.GetDogPictureAsync(); stream.Seek(0, SeekOrigin.Begin); await Context.Channel.SendFileAsync(stream, "dog.png"); }
public async Task Service_Returns_DefaultValue() { var httpClient = new MockHttpClient(Responses); var dogs = new DogPictureService(httpClient, "broken_dog_url"); var stream = await dogs.GetDogPictureAsync(); var response = new StreamReader(stream).ReadToEnd(); Assert.AreEqual("a picture of a default dog", response); }
public async Task Service_Returns_Dog() { var httpClient = new MockHttpClient(Responses); var dogs = new DogPictureService(httpClient, "test_dog_url"); var stream = await dogs.GetDogPictureAsync(); var actual = new StreamReader(stream).ReadToEnd(); Assert.AreEqual("a picture of a dog", actual); }