Exemplo n.º 1
0
        /// <summary>
        /// Copy the message into the <paramref name="destination" />.
        /// </summary>
        /// <param name="destination">The object, to which copied information.</param>
        public override void CopyTo(ProductInfoMessage destination)
        {
            if (destination == null)
            {
                throw new ArgumentNullException(nameof(destination));
            }

            base.CopyTo(destination);

            destination.Id            = Id;
            destination.Name          = Name;
            destination.Description   = Description;
            destination.PackageId     = PackageId;
            destination.Repository    = Repository;
            destination.Tags          = Tags;
            destination.Author        = Author;
            destination.Price         = Price?.Clone();
            destination.DownloadCount = DownloadCount;
            destination.Rating        = Rating;
            destination.DocUrl        = DocUrl;
#pragma warning disable CS0618 // Type or member is obsolete
            destination.IsRequiredConnectors = IsRequiredConnectors;
#pragma warning restore CS0618 // Type or member is obsolete
            destination.SupportedPlugins = SupportedPlugins;
            destination.ContentType      = ContentType;
            destination.Picture          = Picture;
            destination.Extra            = Extra;
        }
Exemplo n.º 2
0
        public override object Clone()
        {
            var result = base.Clone() as Shipment;

            result.Price                 = Price?.Clone() as Money;
            result.PriceWithTax          = PriceWithTax?.Clone() as Money;
            result.DiscountAmount        = DiscountAmount?.Clone() as Money;
            result.DiscountAmountWithTax = DiscountAmountWithTax?.Clone() as Money;
            result.Total                 = Total?.Clone() as Money;
            result.TotalWithTax          = TotalWithTax?.Clone() as Money;
            result.TaxTotal              = TaxTotal?.Clone() as Money;


            if (Discounts != null)
            {
                result.Discounts = new List <Discount>(Discounts.Select(x => x.Clone() as Discount));
            }
            if (TaxDetails != null)
            {
                result.TaxDetails = new List <TaxDetail>(TaxDetails.Select(x => x.Clone() as TaxDetail));
            }
            if (Items != null)
            {
                result.Items = new List <CartShipmentItem>(Items.Select(x => x.Clone() as CartShipmentItem));
            }
            if (ValidationErrors != null)
            {
                result.ValidationErrors = new List <ValidationError>(ValidationErrors.Select(x => x.Clone() as ValidationError));
            }

            return(result);
        }
Exemplo n.º 3
0
        protected void InitializePrices()
        {
            var tmpPrices = new List <Price>();

            PricesMap = new Dictionary <Price, Price>();

            if (InnerItem != null)
            {
                foreach (var price in InnerItem.Prices)
                {
                    // rp: this provoke a lot of unnecessary validation activities
                    // proxyPrice.InjectFrom<CloneInjection>(price);
                    // var proxyPrice = new Price();

                    var proxyPrice = Price.Clone(price);

                    tmpPrices.Add(proxyPrice);
                    PricesMap.Add(proxyPrice, price);
                }

                OnUIThread(() =>
                {
                    Prices = new ObservableCollection <Price>(tmpPrices);
                    OnSpecifiedPropertyChanged("Prices");
                });
            }
        }
Exemplo n.º 4
0
        public override object Clone()
        {
            var result = base.Clone() as ShippingMethod;

            result.Price          = Price?.Clone() as Money;
            result.DiscountAmount = DiscountAmount?.Clone() as Money;
            return(result);
        }
Exemplo n.º 5
0
        public virtual object Clone()
        {
            var result = MemberwiseClone() as CartProduct;

            result.Inventory = Inventory?.Clone() as InventoryInfo;
            result.Price     = Price?.Clone() as ProductPrice;
            result.Product   = Product.Clone() as CatalogProduct;

            return(result);
        }
Exemplo n.º 6
0
        public virtual object Clone()
        {
            var result = MemberwiseClone() as LineItem;

            result.Price             = Price?.Clone() as Price;
            result.TaxDetails        = TaxDetails?.Select(x => x.Clone()).OfType <TaxDetail>().ToList();
            result.Discounts         = Discounts?.Select(x => x.Clone()).OfType <Discount>().ToList();
            result.DynamicProperties = DynamicProperties?.Select(x => x.Clone()).OfType <DynamicObjectProperty>().ToList();

            return(result);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Test methods exposed by the EntityHelper class.
        /// </summary>
        private void Step_20_TestEntityHelper_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                mock = CreateMockInstance(tm);

                Price entity = mock.Copy() as Price;
                entity = (Price)mock.Clone();
                Assert.IsTrue(Price.ValueEquals(entity, mock), "Clone is not working");
            }
        }
        public override object Clone()
        {
            var result = MemberwiseClone() as TierPrice;

            result.Currency       = Currency?.Clone() as Currency;
            result.DiscountAmount = DiscountAmount?.Clone() as Money;
            result.Price          = Price?.Clone() as Money;
            result.TaxDetails     = TaxDetails?.Select(x => x.Clone() as TaxDetail).ToList();

            return(result);
        }
Exemplo n.º 9
0
 public override Base Clone()
 {
     return(new Product()
     {
         Id = Id,
         Name = Name,
         Description = Description,
         Price = (Price == null)? null : Price.Clone() as ProductPrice,
         Category = Category
     });
 }
Exemplo n.º 10
0
        public object Clone()
        {
            var dico = AllocationTools <AllocationElement> .DeepCopy(Data);

            var        fees = (AllocationElement)Fees.Clone();
            Allocation res  = new Allocation(CcyRef, dico, fees)
            {
                Total = (Price)Total.Clone()
            };

            return(res);
        }
Exemplo n.º 11
0
        public void CloneAndEquals()
        {
            var a = new Accounting()
            {
                Description = "xyz"
            };
            var p = new Price(1, 10, CurrencyUnit.EUR)
            {
                Description = "abc", Accounting = a, Stamp = DateTime.Now
            };

            Assert.AreEqual(p, p.Clone());
        }
Exemplo n.º 12
0
        public override object Clone()
        {
            var result = base.Clone() as PaymentMethod;

            result.Price          = Price?.Clone() as Money;
            result.DiscountAmount = DiscountAmount?.Clone() as Money;
            if (Discounts != null)
            {
                result.Discounts = new List <Discount>(Discounts.Select(x => x.Clone() as Discount));
            }
            if (TaxDetails != null)
            {
                result.TaxDetails = new List <TaxDetail>(TaxDetails.Select(x => x.Clone() as TaxDetail));
            }
            return(result);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Copy the message into the <paramref name="destination" />.
        /// </summary>
        /// <param name="destination">The object, to which copied information.</param>
        public override void CopyTo(ProductInfoMessage destination)
        {
            if (destination == null)
            {
                throw new ArgumentNullException(nameof(destination));
            }

            base.CopyTo(destination);

            destination.Id                   = Id;
            destination.Name                 = Name;
            destination.Description          = Description;
            destination.PackageId            = PackageId;
            destination.Tags                 = Tags;
            destination.Author               = Author;
            destination.Price                = Price?.Clone();
            destination.DownloadCount        = DownloadCount;
            destination.Rating               = Rating;
            destination.DocUrl               = DocUrl;
            destination.IsRequiredConnectors = IsRequiredConnectors;
            destination.ContentType          = ContentType;
        }
Exemplo n.º 14
0
        public void AggregatorMaxFirst()
        {
            Price p22a = p22.Clone();

            Assert.AreEqual(Price.Max(p11, p22, p22a), p22);
        }
Exemplo n.º 15
0
        public void AggregatorMinFirst()
        {
            Price p11a = p11.Clone();

            Assert.AreEqual(Price.Min(p11, p22, p11a), p11);
        }