• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# OrganisationBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中OrganisationBuilder的典型用法代码示例。如果您正苦于以下问题:C# OrganisationBuilder类的具体用法?C# OrganisationBuilder怎么用?C# OrganisationBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



OrganisationBuilder类属于命名空间,在下文中一共展示了OrganisationBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Edit

        public void Edit()
        {
            // Arrange
            var organisation = new OrganisationBuilder(this.Session).Build();
            this.Session.Derive();
            this.Session.Commit();

            var edit = new Edit
            {
                Id = organisation.Id.ToString(),
                Description = "Hello",
                Owner = new Select(),
                Werknemers = new MultipleSelect()
            };

            var controller = new OrganisationController { AllorsSession = this.Session };

            // Act
            var viewResult = (ViewResult)controller.Edit(edit, Command.Save);

            // Assert
            viewResult.TempData.Count.ShouldEqual(0);

            organisation.Description.ShouldEqual("Hello");
        }
开发者ID:whesius,项目名称:allors,代码行数:25,代码来源:EditTests.cs


示例2: GivenEngagement_WhenDeriving_ThenDescriptionIsRequired

        public void GivenEngagement_WhenDeriving_ThenDescriptionIsRequired()
        {
            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
            var billToContactMechanism = new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build();
            var partyContactMechanism = new PartyContactMechanismBuilder(this.DatabaseSession)
                .WithContactMechanism(billToContactMechanism)
                .WithContactPurpose(new ContactMechanismPurposes(this.DatabaseSession).BillingAddress)
                .WithUseAsDefault(true)
                .Build();

            var customer = new OrganisationBuilder(this.DatabaseSession).WithName("customer").WithPartyContactMechanism(partyContactMechanism).Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            var builder = new EngagementBuilder(this.DatabaseSession);
            var customEngagementItem = builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithDescription("Engagement");
            customEngagementItem = builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithBillToParty(customer);
            customEngagementItem = builder.Build();

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);
        }
开发者ID:Allors,项目名称:apps,代码行数:34,代码来源:EngagementTests.cs


示例3: GivenOrder_WhenDeriving_ThenLocaleMustExist

        public void GivenOrder_WhenDeriving_ThenLocaleMustExist()
        {
            var englischLocale = new Locales(this.DatabaseSession).EnglishGreatBritain;

            var supplier = new OrganisationBuilder(this.DatabaseSession).WithName("supplier").Build();
            var internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");
            new SupplierRelationshipBuilder(this.DatabaseSession).WithSupplier(supplier).WithInternalOrganisation(internalOrganisation).Build();

            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
            ContactMechanism takenViaContactMechanism = new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build();
            var supplierContactMechanism = new PartyContactMechanismBuilder(this.DatabaseSession)
                .WithContactMechanism(takenViaContactMechanism)
                .WithUseAsDefault(true)
                .WithContactPurpose(new ContactMechanismPurposes(this.DatabaseSession).OrderAddress)
                .Build();
            supplier.AddPartyContactMechanism(supplierContactMechanism);

            var order = new PurchaseOrderBuilder(this.DatabaseSession)
                .WithTakenViaSupplier(supplier)
                .WithShipToBuyer(internalOrganisation)
                .Build();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(englischLocale, order.Locale);
        }
开发者ID:Allors,项目名称:apps,代码行数:26,代码来源:PurchaseOrderTests.cs


示例4: GivenOrder_WhenDeriving_ThenRequiredRelationsMustExist

        public void GivenOrder_WhenDeriving_ThenRequiredRelationsMustExist()
        {
            var supplier = new OrganisationBuilder(this.DatabaseSession).WithName("supplier").Build();
            var internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");
            new SupplierRelationshipBuilder(this.DatabaseSession).WithSupplier(supplier).WithInternalOrganisation(internalOrganisation).Build();

            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
            ContactMechanism takenViaContactMechanism = new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build();
            var supplierContactMechanism = new PartyContactMechanismBuilder(this.DatabaseSession)
                .WithContactMechanism(takenViaContactMechanism)
                .WithUseAsDefault(true)
                .WithContactPurpose(new ContactMechanismPurposes(this.DatabaseSession).OrderAddress)
                .Build();
            supplier.AddPartyContactMechanism(supplierContactMechanism);

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            var builder = new PurchaseOrderBuilder(this.DatabaseSession);
            builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithTakenViaSupplier(supplier);
            builder.Build();

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);

            builder.WithTakenViaContactMechanism(takenViaContactMechanism);
            builder.Build();

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);
        }
开发者ID:Allors,项目名称:apps,代码行数:35,代码来源:PurchaseOrderTests.cs


示例5: GivenOrganisation_WhenCurrentUserIsContactForOrganisation_ThenCustomerPermissionsAreGranted

        public void GivenOrganisation_WhenCurrentUserIsContactForOrganisation_ThenCustomerPermissionsAreGranted()
        {
            var internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");
            var organisation = new OrganisationBuilder(this.DatabaseSession).WithName("organisation").Build();
            var customer = new PersonBuilder(this.DatabaseSession).WithLastName("Customer").WithUserName("customer").Build();

            new CustomerRelationshipBuilder(this.DatabaseSession).WithCustomer(organisation).WithInternalOrganisation(internalOrganisation).Build();
            new OrganisationContactRelationshipBuilder(this.DatabaseSession).WithContact(customer).WithOrganisation(organisation).WithFromDate(DateTime.UtcNow).Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("customer", "Forms"), new string[0]);
            var acl = new AccessControlList(organisation, new Users(this.DatabaseSession).GetCurrentUser());

            Assert.IsTrue(acl.CanRead(Organisations.Meta.Name));
            Assert.IsTrue(acl.CanWrite(Organisations.Meta.Name));
            Assert.IsTrue(acl.CanRead(Organisations.Meta.LegalForm));
            Assert.IsTrue(acl.CanWrite(Organisations.Meta.LegalForm));
            Assert.IsTrue(acl.CanRead(Organisations.Meta.LogoImage));
            Assert.IsTrue(acl.CanWrite(Organisations.Meta.LogoImage));
            Assert.IsTrue(acl.CanRead(Organisations.Meta.Locale));
            Assert.IsTrue(acl.CanWrite(Organisations.Meta.Locale));

            Assert.IsFalse(acl.CanRead(Organisations.Meta.OwnerSecurityToken));
            Assert.IsFalse(acl.CanWrite(Organisations.Meta.OwnerSecurityToken));
        }
开发者ID:Allors,项目名称:apps,代码行数:27,代码来源:OrganisationTests.cs


示例6: GivenOrderRequirementCommitment_WhenDeriving_ThenRequiredRelationsMustExist

        public void GivenOrderRequirementCommitment_WhenDeriving_ThenRequiredRelationsMustExist()
        {
            var shipToCustomer = new OrganisationBuilder(this.DatabaseSession).WithName("shipToCustomer").Build();
            var billToCustomer = new OrganisationBuilder(this.DatabaseSession).WithName("billToCustomer").Build();

            new CustomerRelationshipBuilder(this.DatabaseSession)
                .WithCustomer(billToCustomer)
                .WithInternalOrganisation(Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation)
                .Build();

            new CustomerRelationshipBuilder(this.DatabaseSession)
                .WithCustomer(shipToCustomer)
                .WithInternalOrganisation(Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation)
                .Build();

            var vatRate21 = new VatRateBuilder(this.DatabaseSession).WithRate(21).Build();
            var good = new GoodBuilder(this.DatabaseSession)
                .WithName("Gizmo")
                .WithSku("10101")
                .WithVatRate(vatRate21)
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            this.DatabaseSession.Derive(true);

            var salesOrder = new SalesOrderBuilder(this.DatabaseSession)
                .WithShipToCustomer(shipToCustomer)
                .WithBillToCustomer(billToCustomer)
                .WithVatRegime(new VatRegimes(this.DatabaseSession).Export)
                .Build();

            var goodOrderItem = new SalesOrderItemBuilder(this.DatabaseSession).WithProduct(good).WithQuantityOrdered(1).Build();
            salesOrder.AddSalesOrderItem(goodOrderItem);

            var customerRequirement = new CustomerRequirementBuilder(this.DatabaseSession).WithDescription("100 gizmo's").Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            var builder = new OrderRequirementCommitmentBuilder(this.DatabaseSession);
            builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithOrderItem(goodOrderItem);
            builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithRequirement(customerRequirement);
            var tsts = builder.Build();

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);
        }
开发者ID:Allors,项目名称:apps,代码行数:59,代码来源:OrderRequirementCommitmentTests.cs


示例7: OrganisationBuilder

        public void GivenOwnCreditCardForInternalOrganisationThatDoesAccounting_WhenDeriving_ThenEitherGeneralLedgerAccountOrJournalMustExist()
        {
            var supplier = new OrganisationBuilder(this.DatabaseSession)
                .WithName("supplier")
                .WithLocale(new Locales(this.DatabaseSession).EnglishGreatBritain)
                .Build();

            var internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");

            var supplierRelationship = new SupplierRelationshipBuilder(this.DatabaseSession)
                .WithSupplier(supplier)
                .WithInternalOrganisation(internalOrganisation)
                .WithFromDate(DateTime.UtcNow)
                .Build();

            var generalLedgerAccount = new GeneralLedgerAccountBuilder(this.DatabaseSession)
                .WithAccountNumber("0001")
                .WithName("GeneralLedgerAccount")
                .WithBalanceSheetAccount(true)
                .Build();

            var internalOrganisationGlAccount = new OrganisationGlAccountBuilder(this.DatabaseSession)
                .WithInternalOrganisation(internalOrganisation)
                .WithGeneralLedgerAccount(generalLedgerAccount)
                .Build();

            var journal = new JournalBuilder(this.DatabaseSession).WithDescription("journal").Build();

            var creditCard = new CreditCardBuilder(this.DatabaseSession)
                .WithCardNumber("4012888888881881")
                .WithExpirationYear(2016)
                .WithExpirationMonth(03)
                .WithNameOnCard("M.E. van Knippenberg")
                .WithCreditCardCompany(new CreditCardCompanyBuilder(this.DatabaseSession).WithName("Visa").Build())
                .Build();

            var paymentMethod = new OwnCreditCardBuilder(this.DatabaseSession)
                .WithCreditCard(creditCard)
                .WithCreditor(supplierRelationship)
                .Build();

            this.DatabaseSession.Commit();

            internalOrganisation.RemovePaymentMethods();
            internalOrganisation.AddPaymentMethod(paymentMethod);
            internalOrganisation.DoAccounting = true;

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            paymentMethod.Journal = journal;

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);

            paymentMethod.RemoveJournal();
            paymentMethod.GeneralLedgerAccount = internalOrganisationGlAccount;

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);
        }
开发者ID:Allors,项目名称:apps,代码行数:58,代码来源:OwnCreditCardTests.cs


示例8: DeletedUserinterfaceable

        public void DeletedUserinterfaceable()
        {
            var organisation = new OrganisationBuilder(this.Session).Build();

            var derivationLog = this.Session.Derive();
            Assert.AreEqual(1, derivationLog.Errors.Length);

            var error = derivationLog.Errors[0];
            Assert.AreEqual("Organisation.Name is required", error.Message);
        }
开发者ID:whesius,项目名称:allors,代码行数:10,代码来源:DefaultDerivationLogTests.cs


示例9: GivenPartyWithOpenOrders_WhenDeriving_ThenOpenOrderAmountIsUpdated

        public void GivenPartyWithOpenOrders_WhenDeriving_ThenOpenOrderAmountIsUpdated()
        {
            var organisation = new OrganisationBuilder(this.DatabaseSession).WithName("customer").Build();
            var internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");
            new CustomerRelationshipBuilder(this.DatabaseSession).WithCustomer(organisation).WithInternalOrganisation(internalOrganisation).Build();

            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();

            var postalAddress = new PostalAddressBuilder(this.DatabaseSession)
                  .WithAddress1("Kleine Nieuwedijkstraat 2")
                  .WithGeographicBoundary(mechelen)
                  .Build();

            var good = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithVatRate(new VatRateBuilder(this.DatabaseSession).WithRate(21).Build())
                .WithName("good")
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            this.DatabaseSession.Derive(true);

            var salesOrder1 = new SalesOrderBuilder(this.DatabaseSession).WithBillToCustomer(organisation).WithShipToAddress(postalAddress).WithComment("salesorder1").Build();
            var orderItem1 = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(good)
                .WithQuantityOrdered(10)
                .WithActualUnitPrice(10)
                .Build();
            salesOrder1.AddSalesOrderItem(orderItem1);

            var salesOrder2 = new SalesOrderBuilder(this.DatabaseSession).WithBillToCustomer(organisation).WithShipToAddress(postalAddress).WithComment("salesorder2").Build();
            var orderItem2 = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(good)
                .WithQuantityOrdered(10)
                .WithActualUnitPrice(10)
                .Build();
            salesOrder2.AddSalesOrderItem(orderItem2);

            var salesOrder3 = new SalesOrderBuilder(this.DatabaseSession).WithBillToCustomer(organisation).WithShipToAddress(postalAddress).WithComment("salesorder3").Build();
            var orderItem3 = new SalesOrderItemBuilder(this.DatabaseSession)
                .WithProduct(good)
                .WithQuantityOrdered(10)
                .WithActualUnitPrice(10)
                .Build();
            salesOrder3.AddSalesOrderItem(orderItem3);
            salesOrder3.Cancel();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(242M, organisation.OpenOrderAmount);
        }
开发者ID:Allors,项目名称:apps,代码行数:52,代码来源:PartyTests.cs


示例10: GivenPurchaseShipmentBuilder_WhenBuild_ThenPostBuildRelationsMustExist

        public void GivenPurchaseShipmentBuilder_WhenBuild_ThenPostBuildRelationsMustExist()
        {
            var supplier = new OrganisationBuilder(this.DatabaseSession).WithName("supplier").Build();
            var internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");
            var shipment = new PurchaseShipmentBuilder(this.DatabaseSession).WithShipFromParty(supplier).Build();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(new PurchaseShipmentObjectStates(this.DatabaseSession).Created, shipment.CurrentObjectState);
            Assert.AreEqual(internalOrganisation, shipment.ShipToParty);
            Assert.AreEqual(internalOrganisation.ShippingAddress, shipment.ShipToAddress);
            Assert.AreEqual(shipment.ShipToParty, shipment.ShipToParty);
        }
开发者ID:Allors,项目名称:apps,代码行数:13,代码来源:PurchaseShipmentTests.cs


示例11: OrganisationBuilder

        public void GivenCashPaymentMethodForInternalOrganisationThatDoesAccounting_WhenDeriving_ThenEitherGeneralLedgerAccountOrJournalMustExist()
        {
            var supplier = new OrganisationBuilder(this.DatabaseSession)
                .WithName("supplier")
                .WithLocale(new Locales(this.DatabaseSession).EnglishGreatBritain)
                .Build();

            var internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");

            var supplierRelationship = new SupplierRelationshipBuilder(this.DatabaseSession)
                .WithSupplier(supplier)
                .WithInternalOrganisation(internalOrganisation)
                .WithFromDate(DateTime.UtcNow)
                .Build();

            var generalLedgerAccount = new GeneralLedgerAccountBuilder(this.DatabaseSession)
                .WithAccountNumber("0001")
                .WithName("GeneralLedgerAccount")
                .WithBalanceSheetAccount(true)
                .Build();

            var internalOrganisationGlAccount = new OrganisationGlAccountBuilder(this.DatabaseSession)
                .WithInternalOrganisation(internalOrganisation)
                .WithGeneralLedgerAccount(generalLedgerAccount)
                .Build();

            var journal = new JournalBuilder(this.DatabaseSession).WithDescription("journal").Build();

            this.DatabaseSession.Commit();

            var cash = new CashBuilder(this.DatabaseSession)
                .WithDescription("description")
                .WithCreditor(supplierRelationship)
                .Build();

            internalOrganisation.RemovePaymentMethods();
            internalOrganisation.AddPaymentMethod(cash);
            internalOrganisation.DoAccounting = true;

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            cash.Journal = journal;

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);

            cash.RemoveJournal();
            cash.GeneralLedgerAccount = internalOrganisationGlAccount;

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);
        }
开发者ID:Allors,项目名称:apps,代码行数:50,代码来源:CashTests.cs


示例12: GivenOrganisation_WhenDeriving_ThenRequiredRelationsMustExist

        public void GivenOrganisation_WhenDeriving_ThenRequiredRelationsMustExist()
        {
            var builder = new OrganisationBuilder(this.DatabaseSession);
            var organisation = builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithName("Organisation");
            organisation = builder.Build();

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);
        }
开发者ID:Allors,项目名称:apps,代码行数:14,代码来源:OrganisationTests.cs


示例13: GivenTaxDue_WhenDeriving_ThenRequiredRelationsMustExist

        public void GivenTaxDue_WhenDeriving_ThenRequiredRelationsMustExist()
        {
            var partyFrom = new OrganisationBuilder(this.DatabaseSession).WithName("party from").Build();
            var partyTo = new OrganisationBuilder(this.DatabaseSession).WithName("party to").Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            var builder = new TaxDueBuilder(this.DatabaseSession);
            var taxDue = builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithDescription("taxdue");
            taxDue = builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithEntryDate(DateTime.UtcNow);
            taxDue = builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithTransactionDate(DateTime.UtcNow.AddYears(1));
            taxDue = builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithFromParty(partyFrom);
            taxDue = builder.Build();

            Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);

            this.DatabaseSession.Rollback();

            builder.WithToParty(partyTo);
            taxDue = builder.Build();

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);
        }
开发者ID:Allors,项目名称:apps,代码行数:48,代码来源:ExternalAccountingTransactionTests.cs


示例14: GivenPurchaseInvoice_WhenDeriving_ThenBilledFromPartyMustBeInSupplierRelationship

        public void GivenPurchaseInvoice_WhenDeriving_ThenBilledFromPartyMustBeInSupplierRelationship()
        {
            var supplier2 = new OrganisationBuilder(this.DatabaseSession).WithName("supplier2").Build();

            var invoice = new PurchaseInvoiceBuilder(this.DatabaseSession)
                .WithInvoiceNumber("1")
                .WithPurchaseInvoiceType(new PurchaseInvoiceTypes(this.DatabaseSession).PurchaseInvoice)
                .WithBilledFromParty(supplier2)
                .WithBilledToInternalOrganisation(new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation"))
                .Build();

            Assert.AreEqual(ErrorMessages.PartyIsNotASupplier, this.DatabaseSession.Derive().Errors[0].Message);

            new SupplierRelationshipBuilder(this.DatabaseSession).WithSupplier(supplier2).WithInternalOrganisation(invoice.BilledToInternalOrganisation).Build();

            Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);
        }
开发者ID:Allors,项目名称:apps,代码行数:17,代码来源:PurchaseInvoiceTests.cs


示例15: StoreBuilder

        public void GivenInternalOrganisationWithInvoiceSequenceFiscalYear_WhenCreatingInvoice_ThenInvoiceNumberFromFiscalYearMustBeUsed()
        {
            var store = new StoreBuilder(this.DatabaseSession).WithName("store")
                .WithDefaultFacility(new Warehouses(this.DatabaseSession).FindBy(Warehouses.Meta.Name, "facility"))
                .WithOwner(new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation"))
                .WithDefaultShipmentMethod(new ShipmentMethods(this.DatabaseSession).Ground)
                .WithDefaultCarrier(new Carriers(this.DatabaseSession).Fedex)
                .Build();

            var customer = new OrganisationBuilder(this.DatabaseSession).WithName("customer").Build();
            var contactMechanism = new PostalAddressBuilder(this.DatabaseSession)
                .WithAddress1("Haverwerf 15")
                .WithPostalBoundary(new PostalBoundaryBuilder(this.DatabaseSession)
                                        .WithLocality("Mechelen")
                                        .WithCountry(new Countries(this.DatabaseSession).FindBy(Countries.Meta.IsoCode, "BE"))
                                        .Build())

                .Build();

            var invoice1 = new SalesInvoiceBuilder(this.DatabaseSession)
                .WithStore(store)
                .WithBillToCustomer(customer)
                .WithBillToContactMechanism(contactMechanism)
                .WithSalesInvoiceType(new SalesInvoiceTypes(this.DatabaseSession).SalesInvoice)
                .WithBilledFromInternalOrganisation(new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation"))
                .Build();

            new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(customer).WithInternalOrganisation(Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation).Build();

            Assert.IsFalse(store.ExistSalesInvoiceCounter);
            Assert.AreEqual(DateTime.UtcNow.Year, store.FiscalYearInvoiceNumbers.First.FiscalYear);
            Assert.AreEqual("1", invoice1.InvoiceNumber);

            var invoice2 = new SalesInvoiceBuilder(this.DatabaseSession)
                .WithStore(store)
                .WithBillToCustomer(customer)
                .WithBillToContactMechanism(contactMechanism)
                .WithSalesInvoiceType(new SalesInvoiceTypes(this.DatabaseSession).SalesInvoice)
                .WithBilledFromInternalOrganisation(new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation"))
                .Build();

            Assert.IsFalse(store.ExistSalesInvoiceCounter);
            Assert.AreEqual(DateTime.UtcNow.Year, store.FiscalYearInvoiceNumbers.First.FiscalYear);
            Assert.AreEqual("2", invoice2.InvoiceNumber);
        }
开发者ID:Allors,项目名称:apps,代码行数:45,代码来源:SalesInvoiceTests.cs


示例16: OrganisationBuilder

        public void GivenNewGoodCoredOnFinishedGood_WhenDeriving_ThenNonSerializedInventryItemIsCreatedForEveryFinishedGoodAndFacility()
        {
            var supplier = new OrganisationBuilder(this.DatabaseSession).WithName("supplier").Build();
            var internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");
            var secondFacility = new WarehouseBuilder(this.DatabaseSession).WithName("second facility").WithOwner(internalOrganisation).Build();

            new SupplierRelationshipBuilder(this.DatabaseSession)
                .WithInternalOrganisation(internalOrganisation)
                .WithSupplier(supplier)
                .WithFromDate(DateTime.UtcNow)
                .Build();

            var finishedGood = new FinishedGoodBuilder(this.DatabaseSession)
                .WithName("part")
                .Build();

            var purchasePrice = new ProductPurchasePriceBuilder(this.DatabaseSession)
                .WithFromDate(DateTime.UtcNow)
                .WithCurrency(new Currencies(this.DatabaseSession).FindBy(Currencies.Meta.IsoCode, "EUR"))
                .WithPrice(1)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            var good = new GoodBuilder(this.DatabaseSession)
                .WithName("Good")
                .WithSku("10101")
                .WithFinishedGood(finishedGood)
                .WithVatRate(new VatRateBuilder(this.DatabaseSession).WithRate(21).Build())
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            new SupplierOfferingBuilder(this.DatabaseSession)
                .WithProduct(good)
                .WithSupplier(supplier)
                .WithProductPurchasePrice(purchasePrice)
                .WithFromDate(DateTime.UtcNow)
                .Build();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(2, good.FinishedGood.InventoryItemsWherePart.Count);
            Assert.AreEqual(1, internalOrganisation.DefaultFacility.InventoryItemsWhereFacility.Count);
            Assert.AreEqual(1, secondFacility.InventoryItemsWhereFacility.Count);
        }
开发者ID:Allors,项目名称:apps,代码行数:44,代码来源:SupplierOfferingTests.cs


示例17: OrganisationBuilder

        public void GivenShipmentReceiptForGoodWithoutSelectedInventoryItemWhenDerivingThenInventoryItemIsFromDefaultFacility()
        {
            var supplier = new OrganisationBuilder(this.DatabaseSession).WithName("supplier").Build();
            var internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");
            new SupplierRelationshipBuilder(this.DatabaseSession).WithSupplier(supplier).WithInternalOrganisation(internalOrganisation).Build();

            var good = new GoodBuilder(this.DatabaseSession)
                .WithName("Good")
                .WithSku("10101")
                .WithVatRate(new VatRateBuilder(this.DatabaseSession).WithRate(21).Build())
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            var order = new PurchaseOrderBuilder(this.DatabaseSession).WithTakenViaSupplier(supplier).Build();

            var item1 = new PurchaseOrderItemBuilder(this.DatabaseSession).WithProduct(good).WithQuantityOrdered(1).Build();
            order.AddPurchaseOrderItem(item1);

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            order.Confirm();

            var shipment = new PurchaseShipmentBuilder(this.DatabaseSession).WithShipFromParty(supplier).Build();
            var shipmentItem = new ShipmentItemBuilder(this.DatabaseSession).WithGood(good).Build();
            shipment.AddShipmentItem(shipmentItem);

            var receipt = new ShipmentReceiptBuilder(this.DatabaseSession)
                .WithQuantityAccepted(1M)
                .WithShipmentItem(shipmentItem)
                .WithOrderItem(item1)
                .Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            shipment.AppsComplete();

            Assert.AreEqual(new Warehouses(this.DatabaseSession).FindBy(Warehouses.Meta.Name, "facility"), receipt.InventoryItem.Facility);
            Assert.AreEqual(good.InventoryItemsWhereGood[0], receipt.InventoryItem);

            this.DatabaseSession.Rollback();
        }
开发者ID:Allors,项目名称:apps,代码行数:44,代码来源:ShipmentReceiptTests.cs


示例18: GiveninvoiceItem_WhenCancelled_ThenInvoiceItemsAreCancelled

        public void GiveninvoiceItem_WhenCancelled_ThenInvoiceItemsAreCancelled()
        {
            var billToCustomer = new OrganisationBuilder(this.DatabaseSession).WithName("customer").Build();
            var contactMechanism = new PostalAddressBuilder(this.DatabaseSession)
                .WithAddress1("Haverwerf 15")
                .WithPostalBoundary(new PostalBoundaryBuilder(this.DatabaseSession)
                                        .WithLocality("Mechelen")
                                        .WithCountry(new Countries(this.DatabaseSession).FindBy(Countries.Meta.IsoCode, "BE"))
                                        .Build())

                .Build();

            var good = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithVatRate(new VatRateBuilder(this.DatabaseSession).WithRate(0).Build())
                .WithName("good")
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            var invoice = new SalesInvoiceBuilder(this.DatabaseSession)
                .WithBillToCustomer(billToCustomer)
                .WithBillToContactMechanism(contactMechanism)
                .WithSalesInvoiceItem(new SalesInvoiceItemBuilder(this.DatabaseSession).WithProduct(good).WithQuantity(1).WithActualUnitPrice(100M).WithSalesInvoiceItemType(new SalesInvoiceItemTypes(this.DatabaseSession).ProductItem).Build())
                .WithSalesInvoiceItem(new SalesInvoiceItemBuilder(this.DatabaseSession).WithProduct(good).WithQuantity(1).WithActualUnitPrice(100M).WithSalesInvoiceItemType(new SalesInvoiceItemTypes(this.DatabaseSession).ProductItem).Build())
                .Build();

            new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(invoice.BillToCustomer).WithInternalOrganisation(Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation).Build();

            this.DatabaseSession.Derive(true);

            invoice.CancelInvoice();

            this.DatabaseSession.Derive(true);

            Assert.AreEqual(new SalesInvoiceObjectStates(this.DatabaseSession).Cancelled, invoice.CurrentObjectState);
            Assert.AreEqual(new SalesInvoiceItemObjectStates(this.DatabaseSession).Cancelled, invoice.SalesInvoiceItems[0].CurrentObjectState);
            Assert.AreEqual(new SalesInvoiceItemObjectStates(this.DatabaseSession).Cancelled, invoice.SalesInvoiceItems[1].CurrentObjectState);
        }
开发者ID:Allors,项目名称:apps,代码行数:42,代码来源:SalesInvoiceTests.cs


示例19: DeniedPermissions

        public void DeniedPermissions()
        {
            var readOrganisationName = this.FindPermission(Organisations.Meta.Name, Operation.Read);
            var databaseRole = new RoleBuilder(this.DatabaseSession).WithName("Role").WithPermission(readOrganisationName).Build();
            var person = new PersonBuilder(this.DatabaseSession).WithFirstName("John").WithLastName("Doe").Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            new AccessControlBuilder(this.DatabaseSession).WithRole(databaseRole).WithSubject(person).Build();
            this.DatabaseSession.Commit();

            var sessions = new ISession[] { this.DatabaseSession, this.CreateWorkspaceSession() };
            foreach (var session in sessions)
            {
                session.Commit();

                var organisation = new OrganisationBuilder(session).WithName("Organisation").Build();

                var token = new SecurityTokenBuilder(session).Build();
                organisation.AddSecurityToken(token);

                var role = (Role)session.Instantiate(new Roles(this.DatabaseSession).FindBy(Roles.Meta.Name, "Role"));
                var accessControl = (AccessControl)session.Instantiate(role.AccessControlsWhereRole.First);
                accessControl.AddObject(token);

                Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);

                var accessList = new AccessControlList(organisation, person);

                Assert.IsTrue(accessList.CanRead(Organisations.Meta.Name));

                organisation.AddDeniedPermission(readOrganisationName);

                accessList = new AccessControlList(organisation, person);

                Assert.IsFalse(accessList.CanRead(Organisations.Meta.Name));

                session.Rollback();
            }
        }
开发者ID:whesius,项目名称:allors,代码行数:41,代码来源:AccessControlListTests.cs


示例20: Conflicts

        public void Conflicts()
        {
            var workspaceSession = this.CreateWorkspaceSession();

            var organisation = new OrganisationBuilder(this.DatabaseSession).WithName("Acme Corp.").Build();

            var disconnectedOrganisation = (Domain.Organisation)workspaceSession.Instantiate(organisation.Strategy.ObjectId);
            disconnectedOrganisation.Name = "Acme Ltd.";

            organisation.Name = "Acme Inc.";
            workspaceSession.DatabaseSession.Commit();

            var conflicts = workspaceSession.Conflicts;

            Assert.AreEqual(1, conflicts.Length);

            var derivationLog = new Derivation(workspaceSession).Log;
            derivationLog.AddConflicts(conflicts);

            Assert.AreEqual(1, derivationLog.Errors.Length);
        }
开发者ID:whesius,项目名称:allors,代码行

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Organization类代码示例发布时间:2022-05-24
下一篇:
C# Org_StaffBLL类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap