本文整理汇总了C#中ItemCollection.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# ItemCollection.Clear方法的具体用法?C# ItemCollection.Clear怎么用?C# ItemCollection.Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemCollection
的用法示例。
在下文中一共展示了ItemCollection.Clear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Clear
public void Clear()
{
var item = Item();
var collection = new ItemCollection {item};
collection.Clear();
Assert.That(collection, Is.Empty);
}
示例2: FullNameCorrectWhenClear
public void FullNameCorrectWhenClear()
{
Enterprise enterprise = new Enterprise { name = "Company" };
ItemCollection<Area> areas = new ItemCollection<Area>(enterprise);
Area area1 = new Area { name = "Area 1" };
Assert.That(area1.FullName, Is.EqualTo("Area 1"));
areas.Add(area1);
Assert.That(areas.Count, Is.EqualTo(1));
Assert.That(area1.FullName, Is.EqualTo("Company.Area 1"));
areas.Clear();
Assert.That(areas.Count, Is.EqualTo(0));
Assert.That(area1.FullName, Is.EqualTo("Area 1"));
}
示例3: Test_sorting_items_inserted_in_sorted_order
public void Test_sorting_items_inserted_in_sorted_order()
{
var item1 = new ActivityMonitorComponent.WorkItem(new WorkItemData { Identifier = 1, Status = WorkItemStatusEnum.Canceled });
var item2 = new ActivityMonitorComponent.WorkItem(new WorkItemData { Identifier = 2, Status = WorkItemStatusEnum.Complete });
var item3 = new ActivityMonitorComponent.WorkItem(new WorkItemData { Identifier = 3, Status = WorkItemStatusEnum.Failed });
var item4 = new ActivityMonitorComponent.WorkItem(new WorkItemData { Identifier = 4, Status = WorkItemStatusEnum.Idle });
var item5 = new ActivityMonitorComponent.WorkItem(new WorkItemData { Identifier = 5, Status = WorkItemStatusEnum.Pending });
var items = new ItemCollection<ActivityMonitorComponent.WorkItem>();
var manager = new ActivityMonitorComponent.WorkItemUpdateManager(items, NoFilter, () => { });
// insert items in sorted order, and verify that this order is preserved
manager.Update(new [] { item1, item2, item3, item4, item5 }, StatusComparison);
Assert.IsTrue(items.SequenceEqual(new[] { item1, item2, item3, item4, item5 }));
// insert items in reverse order, and verify that they still end up in sorted order
items.Clear();
manager.Update(new[] { item5, item4, item3, item2, item1 }, StatusComparison);
Assert.IsTrue(items.SequenceEqual(new[] { item1, item2, item3, item4, item5 }));
// insert items out of sorted order, and verify that they still end up in sorted order
items.Clear();
manager.Update(new[] { item3, item5, item4, item1, item2 }, StatusComparison);
Assert.IsTrue(items.SequenceEqual(new[] { item1, item2, item3, item4, item5 }));
}
示例4: Clear
public void Clear()
{
var collection = new ItemCollection();
collection.Add(_itemFactory.Build(ItemCode.LightFrigate, 1));
collection.Clear();
Assert.That(collection.Count, Is.EqualTo(0));
}