本文整理汇总了C#中OrganisationBuilder.AddPartyContactMechanism方法的典型用法代码示例。如果您正苦于以下问题:C# OrganisationBuilder.AddPartyContactMechanism方法的具体用法?C# OrganisationBuilder.AddPartyContactMechanism怎么用?C# OrganisationBuilder.AddPartyContactMechanism使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OrganisationBuilder
的用法示例。
在下文中一共展示了OrganisationBuilder.AddPartyContactMechanism方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: GivenOrderItem_WhenDeriving_ThenRequiredRelationsMustExist
public void GivenOrderItem_WhenDeriving_ThenRequiredRelationsMustExist()
{
this.InstantiateObjects(this.DatabaseSession);
var buyer = new OrganisationBuilder(this.DatabaseSession).WithName("buyer").Build();
var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
var shipToContactMechanism = new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build();
var partyContactMechanism = new PartyContactMechanismBuilder(this.DatabaseSession).WithContactMechanism(shipToContactMechanism).Build();
var part = new RawMaterialBuilder(this.DatabaseSession).WithName("raw stuff").Build();
buyer.AddPartyContactMechanism(partyContactMechanism);
this.DatabaseSession.Derive(true);
this.DatabaseSession.Commit();
var builder = new PurchaseOrderItemBuilder(this.DatabaseSession);
order.AddPurchaseOrderItem(builder.Build());
Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);
this.DatabaseSession.Rollback();
builder.WithPart(part);
order.AddPurchaseOrderItem(builder.Build());
Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);
builder.WithProduct(new GoodBuilder(this.DatabaseSession).Build());
var orderItem = builder.Build();
order.AddPurchaseOrderItem(orderItem);
Assert.IsTrue(this.DatabaseSession.Derive().HasErrors);
orderItem.RemovePart();
Assert.IsFalse(this.DatabaseSession.Derive().HasErrors);
}
示例4: GivenCustomerShipmentWithShipToCustomerWithShippingAddress_WhenDeriving_ThenShipToAddressMustExist
public void GivenCustomerShipmentWithShipToCustomerWithShippingAddress_WhenDeriving_ThenShipToAddressMustExist()
{
var customer = new OrganisationBuilder(this.DatabaseSession).WithName("customer").Build();
var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
var shipToAddress = new PostalAddressBuilder(this.DatabaseSession).WithAddress1("Haverwerf 15").WithGeographicBoundary(mechelen).Build();
var shippingAddress = new PartyContactMechanismBuilder(this.DatabaseSession)
.WithContactMechanism(shipToAddress)
.WithContactPurpose(new ContactMechanismPurposes(this.DatabaseSession).ShippingAddress)
.WithUseAsDefault(true)
.Build();
customer.AddPartyContactMechanism(shippingAddress);
this.DatabaseSession.Derive(true);
var customerShipment = new CustomerShipmentBuilder(this.DatabaseSession)
.WithShipToParty(customer)
.WithShipToAddress(shipToAddress)
.WithShipmentMethod(new ShipmentMethods(this.DatabaseSession).Ground)
.Build();
this.DatabaseSession.Derive(true);
Assert.AreEqual(shippingAddress.ContactMechanism, customerShipment.ShipToAddress);
}
示例5: GivenSalesInvoiceWithShipToCustomerWithShippingAddress_WhenDeriving_ThenShipToAddressMustExist
public void GivenSalesInvoiceWithShipToCustomerWithShippingAddress_WhenDeriving_ThenShipToAddressMustExist()
{
var customer = new OrganisationBuilder(this.DatabaseSession).WithName("customer").Build();
var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
ContactMechanism shipToContactMechanism = new PostalAddressBuilder(this.DatabaseSession).WithAddress1("Haverwerf 15").WithGeographicBoundary(mechelen).Build();
var shippingAddress = new PartyContactMechanismBuilder(this.DatabaseSession)
.WithContactMechanism(shipToContactMechanism)
.WithContactPurpose(new ContactMechanismPurposes(this.DatabaseSession).ShippingAddress)
.WithUseAsDefault(true)
.Build();
customer.AddPartyContactMechanism(shippingAddress);
this.DatabaseSession.Derive(true);
var invoice = new SalesInvoiceBuilder(this.DatabaseSession)
.WithBillToCustomer(customer)
.WithShipToCustomer(customer)
.WithBillToContactMechanism(shipToContactMechanism)
.Build();
new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(customer).WithInternalOrganisation(Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation).Build();
this.DatabaseSession.Derive(true);
Assert.AreEqual(shippingAddress.ContactMechanism, invoice.ShipToAddress);
}