本文整理汇总了C#中SalesOrderItemBuilder.Reject方法的典型用法代码示例。如果您正苦于以下问题:C# SalesOrderItemBuilder.Reject方法的具体用法?C# SalesOrderItemBuilder.Reject怎么用?C# SalesOrderItemBuilder.Reject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SalesOrderItemBuilder
的用法示例。
在下文中一共展示了SalesOrderItemBuilder.Reject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GivenOrderItem_WhenObjectStateIsRejected_ThenItemMayNotBeCancelledOrRejectedOrDeleted
public void GivenOrderItem_WhenObjectStateIsRejected_ThenItemMayNotBeCancelledOrRejectedOrDeleted()
{
var administrator = new PersonBuilder(this.DatabaseSession).WithFirstName("Koen").WithUserName("admin").Build();
var administrators = new UserGroups(this.DatabaseSession).Administrators;
administrators.AddMember(administrator);
this.DatabaseSession.Derive(true);
this.DatabaseSession.Commit();
this.InstantiateObjects(this.DatabaseSession);
Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("admin", "Forms"), new string[0]);
var item = new SalesOrderItemBuilder(this.DatabaseSession)
.WithProduct(this.good)
.WithQuantityOrdered(3)
.WithActualUnitPrice(5)
.Build();
this.order.AddSalesOrderItem(item);
this.DatabaseSession.Derive(true);
item.Reject();
this.DatabaseSession.Derive(true);
Assert.AreEqual(new SalesOrderItemObjectStates(this.DatabaseSession).Rejected, item.CurrentObjectState);
var acl = new AccessControlList(item, new Users(this.DatabaseSession).GetCurrentUser());
Assert.IsFalse(acl.CanExecute(SalesOrderItems.Meta.Cancel));
Assert.IsFalse(acl.CanExecute(SalesOrderItems.Meta.Reject));
}
示例2: SalesOrderItemBuilder
public void GivenConfirmedOrderItemForGood_WhenOrderItemIsRejected_ThenNonSerializedInventoryQuantitiesAreReleased()
{
this.InstantiateObjects(this.DatabaseSession);
var item = new SalesOrderItemBuilder(this.DatabaseSession)
.WithProduct(this.good)
.WithQuantityOrdered(3)
.WithActualUnitPrice(5)
.Build();
this.order.AddSalesOrderItem(item);
this.DatabaseSession.Derive(true);
this.order.Confirm();
this.DatabaseSession.Derive(true);
Assert.AreEqual(item.QuantityOrdered, item.ReservedFromInventoryItem.QuantityCommittedOut);
Assert.AreEqual(0, item.ReservedFromInventoryItem.AvailableToPromise);
var previous = item.ReservedFromInventoryItem;
this.DatabaseSession.Derive(true);
item.Reject();
this.DatabaseSession.Derive(true);
Assert.AreEqual(0, previous.QuantityCommittedOut);
Assert.AreEqual(0, previous.AvailableToPromise);
}