public void TestGetProfile_NotFound() { var controller = new GravatarController(); var result = controller.GetProfile("").Result; Assert.IsFalse(string.IsNullOrEmpty(result.ErrorMessage)); }
public void TestGetProfile_OtherEmail() { var controller = new GravatarController(); var profileResult = controller.GetProfile(TestCommon.EmailOther).Result; Assert.AreEqual(profileResult.Profile.Id, "5123487"); }
public void TestGetProfile() { var controller = new GravatarController(); var profileResult = controller.GetProfile(TestCommon.Email).Result; Assert.AreEqual(profileResult.Profile.Id, "29792710"); }
private async void GetUserProfileBtn_Click(object sender, RoutedEventArgs e) { var controller = new GravatarController(); var profileResult = await controller.GetProfile(InputTextBox.Text); if (profileResult.Profile != null) { Image.Source = new BitmapImage(new Uri(GravatarController.GetImageUrl(InputTextBox.Text, (int)Image.Width))); IdTextBox.Text = profileResult.Profile.Id; HashTextBox.Text = profileResult.Profile.Hash; FullNameTextBox.Text = profileResult.Profile.FullName; UsernameTextBox.Text = profileResult.Profile.UserName; } else { MessageBox.Show(this, profileResult.ErrorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }