本文整理汇总了C#中Nop.Core.Domain.Common.Address.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# Address.Clone方法的具体用法?C# Address.Clone怎么用?C# Address.Clone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nop.Core.Domain.Common.Address
的用法示例。
在下文中一共展示了Address.Clone方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_clone_address
public void Can_clone_address()
{
var address = new Address
{
Id = 1,
FirstName = "FirstName 1",
LastName = "LastName 1",
Email = "Email 1",
Company = "Company 1",
CountryId = 3,
Country = new Country() { Id = 3, Name = "United States" },
StateProvinceId = 4,
StateProvince = new StateProvince() { Id = 4, Name = "LA" },
City = "City 1",
Address1 = "Address1",
Address2 = "Address2",
ZipPostalCode = "ZipPostalCode 1",
PhoneNumber = "PhoneNumber 1",
FaxNumber = "FaxNumber 1",
CreatedOnUtc = new DateTime(2010, 01, 01),
};
var newAddress = address.Clone() as Address;
newAddress.ShouldNotBeNull();
newAddress.Id.ShouldEqual(0);
newAddress.FirstName.ShouldEqual("FirstName 1");
newAddress.LastName.ShouldEqual("LastName 1");
newAddress.Email.ShouldEqual("Email 1");
newAddress.Company.ShouldEqual("Company 1");
newAddress.City.ShouldEqual("City 1");
newAddress.Address1.ShouldEqual("Address1");
newAddress.Address2.ShouldEqual("Address2");
newAddress.ZipPostalCode.ShouldEqual("ZipPostalCode 1");
newAddress.PhoneNumber.ShouldEqual("PhoneNumber 1");
newAddress.FaxNumber.ShouldEqual("FaxNumber 1");
newAddress.CreatedOnUtc.ShouldEqual(new DateTime(2010, 01, 01));
newAddress.Country.ShouldNotBeNull();
newAddress.CountryId.ShouldEqual(3);
newAddress.Country.Name.ShouldEqual("United States");
newAddress.StateProvince.ShouldNotBeNull();
newAddress.StateProvinceId.ShouldEqual(4);
newAddress.StateProvince.Name.ShouldEqual("LA");
}