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


C# Address.Clone方法代码示例

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


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