当前位置: 首页>>代码示例>>C#>>正文


C# SalesOrderItemBuilder.Reject方法代码示例

本文整理汇总了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));
        }
开发者ID:Allors,项目名称:apps,代码行数:32,代码来源:SalesOrderItemTests.cs

示例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);
        }
开发者ID:Allors,项目名称:apps,代码行数:32,代码来源:SalesOrderItemTests.cs


注:本文中的SalesOrderItemBuilder.Reject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。