本文整理汇总了C#中Store.Checkout方法的典型用法代码示例。如果您正苦于以下问题:C# Store.Checkout方法的具体用法?C# Store.Checkout怎么用?C# Store.Checkout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store.Checkout方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ItOverwritesNewItemPricesBetweenCheckouts
public void ItOverwritesNewItemPricesBetweenCheckouts()
{
var store = new Store();
store.AddItemPrices(new ItemPrice() { Name = "Apple", Price = 1 });
store.Checkout(new ScannedItem { Name = "Apple" });
store.AddItemPrices(new ItemPrice() { Name = "Apple", Price = 2 });
var receipt2 = store.Checkout(new ScannedItem { Name = "Apple" });
Assert.AreEqual(2, receipt2.GetItems()[0].Price);
}
示例2: ItCreatesAStoreFromItems
public void ItCreatesAStoreFromItems()
{
var store = new Store();
store.AddItemPrices(new ItemPrice() { Name = "Apple", Price = 1 });
var receipt = store.Checkout(new ScannedItem { Name = "Apple" });
Assert.AreEqual(1, receipt.GetItems().Count);
Assert.AreEqual(1, receipt.GetItems()[0].Price);
}