本文整理汇总了C#中Order.AddAdjustment方法的典型用法代码示例。如果您正苦于以下问题:C# Order.AddAdjustment方法的具体用法?C# Order.AddAdjustment怎么用?C# Order.AddAdjustment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Order
的用法示例。
在下文中一共展示了Order.AddAdjustment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_be_able_to_remove_adjustment
public void Should_be_able_to_remove_adjustment()
{
var order = new Order();
var adjustment = new OrderAdjustment();
order.AddAdjustment(adjustment);
order.RemoveAdjustment(adjustment);
adjustment.Order.ShouldBeNull();
order.Adjustments.ShouldBeEmpty();
}
示例2: Delete_should_delete_adjustment
public void Delete_should_delete_adjustment()
{
var order = new Order { Id = 66 };
var adjustment = new OrderAdjustment();
order.AddAdjustment(adjustment);
orderAdjustmentController.Delete(adjustment)
.ReturnsRedirectToRouteResult()
.ToAction("Item")
.ToController("Order")
.WithRouteValue("Id", "66");
order.Adjustments.ShouldBeEmpty();
orderRepository.AssertWasCalled(r => r.SaveOrUpdate(order));
}
示例3: Should_be_able_to_add_an_adjustment_to_an_order
public void Should_be_able_to_add_an_adjustment_to_an_order()
{
var order = new Order();
order.AddLine("widget 1", 1, new Money(12.34M), "abc", 102, "-");
order.AddLine("gadget 1", 2, new Money(3.55M), "def", 101, "-");
order.AddLine("gadget 1", 2, new Money(3.55M), "def", 101, "-");
order.Postage = PostageResult.WithPrice(new Money(1.33M), "for London");
var expectedAdjustedTotal = order.Total + new Money(-4.50M);
var adjustment = new OrderAdjustment
{
Description = "4.50 off for slight scuffing",
Amount = new Money(-4.50M)
};
order.AddAdjustment(adjustment);
order.Adjustments[0].ShouldBeTheSameAs(adjustment);
adjustment.Order.ShouldBeTheSameAs(order);
order.Adjustments[0].Description.ShouldEqual("4.50 off for slight scuffing");
order.Total.ShouldEqual(expectedAdjustedTotal);
}