我正在 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;
}
如何使用它创建测试?什么是模拟对象?
谢谢