【发布时间】:2013-03-04 02:31:53
【问题描述】:
我正在 Windows 8 中开发一个通过 linqtotwitter nuGet 查询 Twitter API 的应用程序。
所以,我有一些函数,如getFollowers()、getFollowing()、getScreenName()getUserInformation()。
我的所有函数都在查询 Twitter,我不知道如何使用这些函数创建单元测试。
谁能给我一个例子?
例如我的 getFollowers() 函数:
public List<string> RecupererFollower()
{
_log.Info("Fonction récupérer follower");
_log.Info("On recherche les follower de "+MainPage.texte);
_log.Info("Cette fonction va créer une liste des id des follower de"+MainPage.texte);
List<string> idFollowers=new List<string>();
var followers =
(from follower in MainPage.twitterCtxProp.SocialGraph
where follower.Type == SocialGraphType.Followers &&
follower.ScreenName == MainPage.texte
select follower)
.ToList();
idFollowers = followers[0].IDs;
return idFollowers;
}
如何使用它创建测试? 什么是模拟对象?
谢谢
【问题讨论】:
标签: c# api unit-testing twitter windows-8