本文整理汇总了C#中ListItemCollection.Should方法的典型用法代码示例。如果您正苦于以下问题:C# ListItemCollection.Should方法的具体用法?C# ListItemCollection.Should怎么用?C# ListItemCollection.Should使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListItemCollection
的用法示例。
在下文中一共展示了ListItemCollection.Should方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddAddsToNewGroupIfGroupDoesntExist
public void AddAddsToNewGroupIfGroupDoesntExist()
{
var list = new ListItemCollection<string>();
list.AddGroup("Hello", new List<string> { "Foo" });
list.Add("World", "Bar");
list.Should().HaveCount(2);
list.Should().Contain(g => g.Title == "Hello" && g.Count == 1 && g[0] == "Foo");
list.Should().Contain(g => g.Title == "World" && g.Count == 1 && g[0] == "Bar");
}
示例2: AddAddsToExistingGroupIfGroupDoesExist
public void AddAddsToExistingGroupIfGroupDoesExist()
{
var list = new ListItemCollection<string>();
list.AddGroup("Hello", new List<string> { "Foo" });
list.Add("Hello", "Bar");
list.Should().HaveCount(1);
list.Should().Contain(g => g.Title == "Hello" && g.Count == 2 &&
g.Contains("Foo") && g.Contains("Bar"));
}
示例3: GroupsAreSorted
public void GroupsAreSorted()
{
var list = new ListItemCollection<string>();
list.AddGroup("Bob", new List<string>
{
"Foo",
"Bar"
});
list.AddGroup("Dave", new List<string>
{
"Hello",
"World"
});
list.Should().HaveCount(2);
list[0].Title.Should().Be("Bob");
list[1].Title.Should().Be("Dave");
list.TitleSortOrder = new List<string>
{
"Dave",
"Colin",
"Bob"
};
list.Should().HaveCount(2);
list[0].Title.Should().Be("Dave");
list[1].Title.Should().Be("Bob");
list.AddGroup("Colin", new List<string>
{
"FooBar",
"HelloWorld"
});
list.Should().HaveCount(3);
list[0].Title.Should().Be("Dave");
list[1].Title.Should().Be("Colin");
list[2].Title.Should().Be("Bob");
list.Delete("FooBar");
list.Delete("HelloWorld");
list.Should().HaveCount(2);
list[0].Title.Should().Be("Dave");
list[1].Title.Should().Be("Bob");
}
示例4: DeleteReturnsFalseIfTheItemDoesnExist
public void DeleteReturnsFalseIfTheItemDoesnExist()
{
var list = new ListItemCollection<string>();
list.AddGroup("Hello", new List<string> { "Foo", "Bar" });
list.Delete("World").Should().BeFalse();
list.Should().HaveCount(1);
list.Should().Contain(g => g.Title == "Hello" && g.Count == 2 &&
g.Contains("Foo") && g.Contains("Bar"));
}
示例5: DeleteRemovesEmptyGroups
public void DeleteRemovesEmptyGroups()
{
var list = new ListItemCollection<string>();
list.AddGroup("Hello", new List<string> { "Foo", "Bar" });
list.AddGroup("World", new List<string> { "FooBar" });
list.Should().HaveCount(2);
list.Delete("FooBar").Should().BeTrue();
list.Should().HaveCount(1);
list.Should().Contain(g => g.Title == "Hello" && g.Count == 2 &&
g.Contains("Foo") && g.Contains("Bar"));
}
示例6: DeleteDeletesItem
public void DeleteDeletesItem()
{
var list = new ListItemCollection<string>();
list.AddGroup("Hello", new List<string> { "Foo", "Bar" });
list.Delete("Foo");
list.Should().HaveCount(1);
list.Should().Contain(g => g.Title == "Hello" && g.Count == 1 && g[0] == "Bar");
}