Example #1
0
        public void TestProductChannelExclusivityGetHashcode()
        {
            ProductChannelExclusivity channelExclusivityA = new ProductChannelExclusivity()
            {
                channelExclusivity = ShoppingProductChannelExclusivity.MULTI_CHANNEL
            };

            ProductChannelExclusivity channelExclusivityB = new ProductChannelExclusivity()
            {
                channelExclusivity = ShoppingProductChannelExclusivity.MULTI_CHANNEL
            };

            ProductChannelExclusivity channelExclusivityC = new ProductChannelExclusivity()
            {
                channelExclusivity = ShoppingProductChannelExclusivity.SINGLE_CHANNEL
            };

            Assert.AreEqual(comparer.GetHashCode(channelExclusivityA),
                            comparer.GetHashCode(channelExclusivityB));
            Assert.AreNotEqual(comparer.GetHashCode(channelExclusivityA),
                               comparer.GetHashCode(channelExclusivityC));
        }
Example #2
0
        public void TestProductChannelExclusivityEquals()
        {
            ProductChannelExclusivity channelExclusivityA = new ProductChannelExclusivity()
            {
                channelExclusivity = ShoppingProductChannelExclusivity.MULTI_CHANNEL
            };

            ProductChannelExclusivity channelExclusivityB =
                ProductDimensions.CreateChannelExclusivity(ShoppingProductChannelExclusivity
                                                           .MULTI_CHANNEL);

            Assert.True(comparer.Equals(channelExclusivityA, channelExclusivityB));

            ProductChannelExclusivity channelExclusivityC = new ProductChannelExclusivity()
            {
            };

            ProductChannelExclusivity channelExclusivityD =
                ProductDimensions.CreateChannelExclusivity();

            Assert.True(comparer.Equals(channelExclusivityC, channelExclusivityD));
        }
Example #3
0
 /// <summary>
 /// Determines whether the specified <see cref="ProductChannelExclusivity"/>
 /// objects are equal.
 /// </summary>
 /// <param name="x">The first object to compare.</param>
 /// <param name="y">The second object to compare.</param>
 /// <returns>
 /// True if the specified objects are equal; otherwise, false.
 /// </returns>
 private bool Equals(ProductChannelExclusivity x, ProductChannelExclusivity y)
 {
     return(x.channelExclusivitySpecified == y.channelExclusivitySpecified &&
            x.channelExclusivity == y.channelExclusivity);
 }
Example #4
0
 /// <summary>
 /// Gets the hash code for a <see cref="ProductChannelExclusivity"/>.
 /// </summary>
 /// <param name="obj">The object to calculate hash code for.</param>
 /// <returns>The hash code.</returns>
 private int GetHashCodeInternal(ProductChannelExclusivity obj)
 {
     return(Tuple
            .Create <bool, ShoppingProductChannelExclusivity>(obj.channelExclusivitySpecified,
                                                              obj.channelExclusivity).GetHashCode());
 }