WP7 앱 코드의 개인 메소드에 대한 단위 테스트를 작성하고 싶습니다. 그래서 Silverlight Unit Test 코드에서 개인 메서드를 호출하는 방법을 알고 싶습니다. 아래는 단위 테스트를 작성하고자하는 코드 스 니펫입니다.단위 테스트 WP7의 개인 메소드
private void Next_Click(object sender, EventArgs e)
{
nextBtn.IsEnabled = false;
checking = true;
App app = Application.Current as App;
//Microsoft.Phone.Controls.TiltEffect.SetIsTiltEnabled((App.Current as App).RootFrame, true);
if (String.IsNullOrEmpty(AppHelper.AuthenticationToken))
{
// Get Authentication Token
try
{
app.Flickr.AuthGetTokenAsync(frob, r =>
{
Dispatcher.BeginInvoke(() =>
{
if (r.HasError)
{
MessageBox.Show("Flickr error (" + r.ErrorMessage + ") - did you click Ok before setting flickr up in your browser?");
}
else
{
// Store the authentication token
AppSettings.AuthenticationToken = r.Result.Token;
if (AppSettings.IsLoginIconPressed == false)
{
NavigationService.Navigate(new Uri("/Upload.xaml", UriKind.Relative));
}
else
{
app.isNavigatedFromPage = true;
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
AppSettings.IsLoginIconPressed = false;
}
}
checking = false;
});
});
}
catch (Exception ex)
{
MessageBox.Show("Flickr error (" + ex.Message + ") - did you click Ok before setting flickr up in your browser?");
}
} // End of if
else
{
if (AppSettings.IsLoginIconPressed == false)
{
app.isNavigatedFromPage = true;
NavigationService.Navigate(new Uri("/Upload.xaml", UriKind.Relative));
}
else
{
app.isNavigatedFromPage = true;
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
AppSettings.IsLoginIconPressed = false;
}
} // End of else
}
공개로 공개합니다 (예 : 비공개에서 공개로 변경). 대부분의 테스트 패키지는 일반적으로 테스트가 필요한 부분 즉 "공용 인터페이스"이므로 공용 인터페이스 만 봅니다. –