本文整理汇总了C#中Network.Follow方法的典型用法代码示例。如果您正苦于以下问题:C# Network.Follow方法的具体用法?C# Network.Follow怎么用?C# Network.Follow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Network
的用法示例。
在下文中一共展示了Network.Follow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetWallReturnsAllPostsForUserAndSubscriptions
public void GetWallReturnsAllPostsForUserAndSubscriptions()
{
var userName = "A";
var message = "New Message";
var anotherMessage = "Another Message";
var secondUserName = "B";
var secondUserMessage = "Second User Message";
var thirdUserName = "C";
var thirdUserMessage = "Third User Message";
var network = new Network();
network.AddPost(userName, message);
network.AddPost(userName, anotherMessage);
network.AddPost(secondUserName, secondUserMessage);
network.AddPost(thirdUserName, thirdUserMessage);
network.Follow(userName, secondUserName);
// Results for A's wall should contain all 3 posts from users A and B.
var results = network.GetWall(userName);
Assert.IsTrue(results.Count() == 3);
Assert.IsTrue(results.Any(x => x.Message == message));
Assert.IsTrue(results.Any(x => x.Message == anotherMessage));
Assert.IsTrue(results.Any(x => x.Message == secondUserMessage));
// However, results when looking at B's wall should only return B's posts.
results = network.GetWall(secondUserName);
Assert.IsTrue(results.Count() == 1);
Assert.IsTrue(results.Any(x => x.Message == secondUserMessage));
}
示例2: GetPostsReturnsAllPostsForUser
public void GetPostsReturnsAllPostsForUser()
{
var userName = "A";
var message = "New Message";
var anotherMessage = "Another Message";
var secondUserName = "B";
var secondUserMessage = "Second User Message";
var network = new Network();
network.AddPost(userName, message);
network.AddPost(userName, anotherMessage);
network.AddPost(secondUserName, secondUserMessage);
network.Follow(userName, secondUserName);
var results = network.GetPosts(userName);
// Results should contain message and anotherMessage but not secondUserMessage.
Assert.IsTrue(results.Count() == 2);
Assert.IsTrue(results.Any(x => x.Message == message));
Assert.IsTrue(results.Any(x => x.Message == anotherMessage));
}