Beispiel #1
0
        public async Task ShouldReturnListOfBreeds()
        {
            // Arrange
            var expectedBreeds = new List <string> {
                "Australian", "Beagle"
            };
            var httpClient = PrepareHttpClient(expectedBreeds);

            _mockHttpClientFactory.Setup(f => f.CreateClient(It.IsAny <string>())).Returns(httpClient);

            // Act
            var breeds = await dogService.GetBreedsAsync();

            // Assert
            Assert.Equal(expectedBreeds, breeds);
        }
Beispiel #2
0
        public async Task GetDogBreedsAsync(CommandContext ctx)
        {
            await ctx.TriggerTypingAsync();

            List <string> breeds = await(_dogService?.GetBreedsAsync());

            if (breeds == null || !breeds.Any())
            {
                await ctx.ErrorAsync("Could not get the dog breeds :(");

                return;
            }
            DiscordEmbedBuilder builder = new DiscordEmbedBuilder()
                                          .WithColor(dogColor)
                                          .WithTitle("Here's a list of available dog breeds:")
                                          .WithDescription(string.Join(", ", breeds));
            await ctx.RespondDeletableAsync(builder.Build());
        }