Exemplo n.º 1
0
        public void TestEqualsObject()
        {
            //Arrange
            //Act
            var result = _shopItem.Equals(new object());

            //Assert
            Assert.False(result);
        }
Exemplo n.º 2
0
 public bool Equals(ShoppingCartItem?other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(ShopItem.Equals(other.ShopItem) && ShopItemId == other.ShopItemId && Amount == other.Amount &&
            ShoppingCartId == other.ShoppingCartId && Id == other.Id);
 }
Exemplo n.º 3
0
        public void Update(ShopItem valueItem)
        {
            ShopItem repositoryItem = Get(valueItem.ArticleNumber);

            if (repositoryItem == null)
            {
                throw new Exception(String.Format("Trying to update an item that does not exist yet: ({0})", valueItem.ToString()));
            }

            if (!repositoryItem.Equals(valueItem))
            {
                repositoryItem.Assign(valueItem);
            }

            if (!SaveOnClose)
            {
                context.Put(repositoryItem);
            }
        }