Exemplo n.º 1
0
        public void EqualsToTier(bool expected, string tier1, string tier2)
        {
            Sku sku1 = new Sku(null, tier1, null, null);
            Sku sku2 = new Sku(null, tier2, null, null);

            if (expected)
            {
                Assert.IsTrue(sku1.Equals(sku2));
            }
            else
            {
                Assert.IsFalse(sku1.Equals(sku2));
            }
        }
Exemplo n.º 2
0
        public void EqualsToCapacity(bool expected, long?capacity1, long?capacity2)
        {
            Sku sku1 = capacity1 == null ? new Sku(null, null, null, null) : new Sku(null, null, null, null, capacity1);
            Sku sku2 = capacity2 == null ? new Sku(null, null, null, null) : new Sku(null, null, null, null, capacity2);

            if (expected)
            {
                Assert.IsTrue(sku1.Equals(sku2));
            }
            else
            {
                Assert.IsFalse(sku1.Equals(sku2));
            }
        }
Exemplo n.º 3
0
        public void EqualsToSize(bool expected, string size1, string size2)
        {
            Sku sku1 = new Sku(null, null, null, size1);
            Sku sku2 = new Sku(null, null, null, size2);

            if (expected)
            {
                Assert.IsTrue(sku1.Equals(sku2));
            }
            else
            {
                Assert.IsFalse(sku1.Equals(sku2));
            }
        }
Exemplo n.º 4
0
        public void EqualsToFamily(bool expected, string family1, string family2)
        {
            Sku sku1 = new Sku(null, null, family1, null);
            Sku sku2 = new Sku(null, null, family2, null);

            if (expected)
            {
                Assert.IsTrue(sku1.Equals(sku2));
            }
            else
            {
                Assert.IsFalse(sku1.Equals(sku2));
            }
        }
Exemplo n.º 5
0
        public void EqualsToName(bool expected, string name1, string name2)
        {
            Sku sku1 = new Sku(name1, null, null, null);
            Sku sku2 = new Sku(name2, null, null, null);

            if (expected)
            {
                Assert.IsTrue(sku1.Equals(sku2));
            }
            else
            {
                Assert.IsFalse(sku1.Equals(sku2));
            }
        }
Exemplo n.º 6
0
        public void EqualsToNullSku()
        {
            Sku sku1 = new Sku(null, null, null, null, null);
            Sku sku2 = null;

            Assert.IsFalse(sku1.Equals(sku2));
        }
Exemplo n.º 7
0
        public void EqualsToSameSkus()
        {
            Sku sku1 = new Sku(null, null, null, null, null);
            Sku sku2 = sku1;

            Assert.IsTrue(sku1.Equals(sku2));
        }
Exemplo n.º 8
0
        public void EqualsToObject()
        {
            Sku    sku1 = new Sku(null, null, null, null);
            object sku2 = "random";

            Assert.IsFalse(sku1.Equals(sku2));
        }
Exemplo n.º 9
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is CatalogItemVariation other &&
                   ((ItemId == null && other.ItemId == null) || (ItemId?.Equals(other.ItemId) == true)) &&
                   ((Name == null && other.Name == null) || (Name?.Equals(other.Name) == true)) &&
                   ((Sku == null && other.Sku == null) || (Sku?.Equals(other.Sku) == true)) &&
                   ((Upc == null && other.Upc == null) || (Upc?.Equals(other.Upc) == true)) &&
                   ((Ordinal == null && other.Ordinal == null) || (Ordinal?.Equals(other.Ordinal) == true)) &&
                   ((PricingType == null && other.PricingType == null) || (PricingType?.Equals(other.PricingType) == true)) &&
                   ((PriceMoney == null && other.PriceMoney == null) || (PriceMoney?.Equals(other.PriceMoney) == true)) &&
                   ((LocationOverrides == null && other.LocationOverrides == null) || (LocationOverrides?.Equals(other.LocationOverrides) == true)) &&
                   ((TrackInventory == null && other.TrackInventory == null) || (TrackInventory?.Equals(other.TrackInventory) == true)) &&
                   ((InventoryAlertType == null && other.InventoryAlertType == null) || (InventoryAlertType?.Equals(other.InventoryAlertType) == true)) &&
                   ((InventoryAlertThreshold == null && other.InventoryAlertThreshold == null) || (InventoryAlertThreshold?.Equals(other.InventoryAlertThreshold) == true)) &&
                   ((UserData == null && other.UserData == null) || (UserData?.Equals(other.UserData) == true)) &&
                   ((ServiceDuration == null && other.ServiceDuration == null) || (ServiceDuration?.Equals(other.ServiceDuration) == true)) &&
                   ((AvailableForBooking == null && other.AvailableForBooking == null) || (AvailableForBooking?.Equals(other.AvailableForBooking) == true)) &&
                   ((ItemOptionValues == null && other.ItemOptionValues == null) || (ItemOptionValues?.Equals(other.ItemOptionValues) == true)) &&
                   ((MeasurementUnitId == null && other.MeasurementUnitId == null) || (MeasurementUnitId?.Equals(other.MeasurementUnitId) == true)) &&
                   ((TeamMemberIds == null && other.TeamMemberIds == null) || (TeamMemberIds?.Equals(other.TeamMemberIds) == true)));
        }
Exemplo n.º 10
0
        public void EqualsToCapacity(bool expected, int?capacity1, int?capacity2)
        {
            Sku sku1 = capacity1 == null ? new Sku(null, null, null, null, null) : new Sku(null, null, null, null, capacity1);
            Sku sku2 = capacity2 == null ? new Sku(null, null, null, null, null) : new Sku(null, null, null, null, capacity2);

            Assert.AreEqual(expected, sku1.Equals(sku2), "Skus did not match expected equals");
            Assert.AreEqual(expected, sku1.GetHashCode() == sku2.GetHashCode(), $"Hashcodes comparison was expect {expected} but was {!expected}, ({sku1.GetHashCode()}, {sku2.GetHashCode()})");
        }
Exemplo n.º 11
0
        public void EqualsToTier(bool expected, SkuTier tier1, SkuTier tier2)
        {
            Sku sku1 = new Sku(null, tier1, null, null, null);
            Sku sku2 = new Sku(null, tier2, null, null, null);

            Assert.AreEqual(expected, sku1.Equals(sku2), "Skus did not match expected equals");
            Assert.AreEqual(expected, sku1.GetHashCode() == sku2.GetHashCode(), $"Hashcodes comparison was expect {expected} but was {!expected}, ({sku1.GetHashCode()}, {sku2.GetHashCode()})");
        }
Exemplo n.º 12
0
        public void EqualsToFamily(bool expected, string family1, string family2)
        {
            Sku sku1 = new Sku(null, null, null, family1, null);
            Sku sku2 = new Sku(null, null, null, family2, null);

            Assert.AreEqual(expected, sku1.Equals(sku2), "Skus did not match expected equals");
            Assert.AreEqual(expected, sku1.GetHashCode() == sku2.GetHashCode(), $"Hashcodes comparison was expect {expected} but was {!expected}, ({sku1.GetHashCode()}, {sku2.GetHashCode()})");
        }
Exemplo n.º 13
0
        public void EqualsToObject()
        {
            Sku    sku1      = new Sku(null, null, null, null, null);
            object sku2      = new Sku("SkuName", null, null, null, null);
            object stringSku = "random";

            Assert.IsFalse(sku1.Equals(stringSku));

            object nullSku = null;

            Assert.IsFalse(sku1.Equals(nullSku));

            object sameSku = sku1;

            Assert.IsTrue(sku1.Equals(sameSku));

            Assert.IsFalse(sku1.Equals(sku2));
        }
Exemplo n.º 14
0
        public bool Equals(Skus other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(false);
            }

            if (Object.ReferenceEquals(this, other))
            {
                return(true);
            }

            return(Sku.Equals(other.Sku));
        }
Exemplo n.º 15
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is V1PaymentItemDetail other &&
                   ((CategoryName == null && other.CategoryName == null) || (CategoryName?.Equals(other.CategoryName) == true)) &&
                   ((Sku == null && other.Sku == null) || (Sku?.Equals(other.Sku) == true)) &&
                   ((ItemId == null && other.ItemId == null) || (ItemId?.Equals(other.ItemId) == true)) &&
                   ((ItemVariationId == null && other.ItemVariationId == null) || (ItemVariationId?.Equals(other.ItemVariationId) == true)));
        }
        public WarehouseAvailableStockItem ApplyStockChanges(WarehouseAvailableStockItem warehouseAvailableStock)
        {
            if (Sku.Equals(warehouseAvailableStock.Sku, StringComparison.OrdinalIgnoreCase) &&
                FulfilmentCentre.Equals(warehouseAvailableStock.FulfilmentCentre, StringComparison.OrdinalIgnoreCase))
            {
                if (Version > warehouseAvailableStock.Version)
                {
                    throw new StaleWarehouseAvailableStockChangedException(
                              $"Stale Warehouse Available Stock Change encountered for SKU {warehouseAvailableStock.Sku} in Warehouse {warehouseAvailableStock.FulfilmentCentre}");
                }

                Pickable  = warehouseAvailableStock.Pickable;
                Reserved  = warehouseAvailableStock.Reserved;
                Allocated = warehouseAvailableStock.Allocated;
                Version   = warehouseAvailableStock.Version;
            }

            return(this);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Returns true if Item instances are equal
        /// </summary>
        /// <param name="other">Instance of Item to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Item other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Upc == other.Upc ||
                     Upc != null &&
                     Upc.Equals(other.Upc)
                     ) &&
                 (
                     Ean == other.Ean ||
                     Ean != null &&
                     Ean.Equals(other.Ean)
                 ) &&
                 (
                     Isbn == other.Isbn ||
                     Isbn != null &&
                     Isbn.Equals(other.Isbn)
                 ) &&
                 (
                     Asin == other.Asin ||
                     Asin != null &&
                     Asin.Equals(other.Asin)
                 ) &&
                 (
                     Title == other.Title ||
                     Title != null &&
                     Title.Equals(other.Title)
                 ) &&
                 (
                     Sku == other.Sku ||
                     Sku != null &&
                     Sku.Equals(other.Sku)
                 ) &&
                 (
                     Mpn == other.Mpn ||
                     Mpn != null &&
                     Mpn.Equals(other.Mpn)
                 ) &&
                 (
                     PartNumber == other.PartNumber ||
                     PartNumber != null &&
                     PartNumber.Equals(other.PartNumber)
                 ) &&
                 (
                     Upcs == other.Upcs ||
                     Upcs != null &&
                     other.Upcs != null &&
                     Upcs.SequenceEqual(other.Upcs)
                 ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Brand == other.Brand ||
                     Brand != null &&
                     Brand.Equals(other.Brand)
                 ) &&
                 (
                     Manufacturer == other.Manufacturer ||
                     Manufacturer != null &&
                     Manufacturer.Equals(other.Manufacturer)
                 ) &&
                 (
                     Color == other.Color ||
                     Color != null &&
                     Color.Equals(other.Color)
                 ) &&
                 (
                     NewPrice == other.NewPrice ||

                     NewPrice.Equals(other.NewPrice)
                 ) &&
                 (
                     UsedPrice == other.UsedPrice ||

                     UsedPrice.Equals(other.UsedPrice)
                 ) &&
                 (
                     CurrencyCode == other.CurrencyCode ||
                     CurrencyCode != null &&
                     CurrencyCode.Equals(other.CurrencyCode)
                 ) &&
                 (
                     Url == other.Url ||
                     Url != null &&
                     Url.Equals(other.Url)
                 ) &&
                 (
                     Features == other.Features ||
                     Features != null &&
                     other.Features != null &&
                     Features.SequenceEqual(other.Features)
                 ) &&
                 (
                     Dimensions == other.Dimensions ||
                     Dimensions != null &&
                     other.Dimensions != null &&
                     Dimensions.SequenceEqual(other.Dimensions)
                 ) &&
                 (
                     Images == other.Images ||
                     Images != null &&
                     other.Images != null &&
                     Images.SequenceEqual(other.Images)
                 ) &&
                 (
                     MatchedItems == other.MatchedItems ||
                     MatchedItems != null &&
                     other.MatchedItems != null &&
                     MatchedItems.SequenceEqual(other.MatchedItems)
                 ) &&
                 (
                     IsoCountryCodes == other.IsoCountryCodes ||
                     IsoCountryCodes != null &&
                     other.IsoCountryCodes != null &&
                     IsoCountryCodes.SequenceEqual(other.IsoCountryCodes)
                 ) &&
                 (
                     CompanyName == other.CompanyName ||
                     CompanyName != null &&
                     CompanyName.Equals(other.CompanyName)
                 ) &&
                 (
                     CompanyAddress == other.CompanyAddress ||
                     CompanyAddress != null &&
                     CompanyAddress.Equals(other.CompanyAddress)
                 ) &&
                 (
                     Categories == other.Categories ||
                     Categories != null &&
                     other.Categories != null &&
                     Categories.SequenceEqual(other.Categories)
                 ) &&
                 (
                     CategoryHierarchies == other.CategoryHierarchies ||
                     CategoryHierarchies != null &&
                     other.CategoryHierarchies != null &&
                     CategoryHierarchies.SequenceEqual(other.CategoryHierarchies)
                 ));
        }