コード例 #1
0
        private async void Tag_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            try
            {
                var client     = new CatFactsClient();
                var randomFact = await client.GetRandomFactsAsync(ServiceLocator.Default.ResolveType <ISettingsManager>().CatFactAnimal.ToString().ToLower());

                Random x       = new Random();
                var    z       = x.Next(0, randomFact.Length);
                var    catfact = randomFact[z].Text;

                if (GetWords(catfact).Count > 1)
                {
                    if (!catfact.Contains("test", StringComparison.OrdinalIgnoreCase))
                    {
                        ServiceLocator.Default.ResolveType <INotificationService>().Info(catfact);
                    }
                }
                else
                {
                }
            }
            catch
            {
            }
        }
コード例 #2
0
        public async Task GetRandomFactsAsync_WithoutQueryParameters_ShouldReturnFactsList()
        {
            // Arrange
            var client = new CatFactsClient();
            // Act
            var facts = await client.GetRandomFactsAsync();

            // Assert
            Assert.NotNull(facts);
        }