本文整理汇总了C#中Bag.GetWeight方法的典型用法代码示例。如果您正苦于以下问题:C# Bag.GetWeight方法的具体用法?C# Bag.GetWeight怎么用?C# Bag.GetWeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bag
的用法示例。
在下文中一共展示了Bag.GetWeight方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestInventoryWeight1
public void TestInventoryWeight1()
{
var inventory = new Bag();
Item item1 = new Item();
item1.Weight = 10;
item1.Effects = new Effect[0];
inventory.Add(item1);
Item item2 = new Item();
item2.Weight = 10;
item2.Effects = new Effect[0];
inventory.Add(item2);
var weight = inventory.GetWeight();
Assert.AreEqual(20 , weight);
}
示例2: TestInventoryRemove
public void TestInventoryRemove()
{
var inventory = new Bag();
Item item1 = new Item();
item1.Id = Guid.NewGuid();
item1.Weight = 10;
item1.Effects = new Effect[0];
inventory.Add(item1);
Item item2 = new Item();
item2.Id = Guid.NewGuid();
item2.Weight = 10;
item2.Effects = new Effect[0];
inventory.Add(item2);
inventory.Remove(item1.Id);
var weight = inventory.GetWeight();
Assert.AreEqual(10, weight);
}