Exemplo n.º 1
0
        public void Constructor_ShouldSetTheTypeCorrectly()
        {
            //Arrange

            var price = Tests.NUMBER_HAS_NO_MEANING_IN_THIS_CONTEXT;
            var jewelCartItem = new JewelCartItem(Tests.FAKE_JEWELRY_REPOSITORY_FIRST_ITEM_ID, JewelMediaType.WhiteGold, price);
            //Act
            var type = jewelCartItem.Type;
            //Assert
            type.Should().Be(CartItemType.Jewelry);
        }
Exemplo n.º 2
0
        public void Constructor_ShouldSetThePriceField()
        {
            //Arrange

            var price = Tests.NUMBER_THAT_IS_ASSERTED_WITH_BUT_HAS_NO_MEANING;
            var jewelCartItem = new JewelCartItem(Tests.FAKE_JEWELRY_REPOSITORY_FIRST_ITEM_ID, JewelMediaType.WhiteGold, price);
            //Act
            var resultprice = jewelCartItem.Price;
            //Assert
            resultprice.Should().Be(price);
        }
Exemplo n.º 3
0
        public void Constructor_ShouldSetTheIDField()
        {
            //Arrange

            var price = Tests.NUMBER_HAS_NO_MEANING_IN_THIS_CONTEXT;
            var jewelCartItem = new JewelCartItem(Tests.FAKE_JEWELRY_REPOSITORY_FIRST_ITEM_ID, JewelMediaType.WhiteGold, price);
            //Act
            var id = jewelCartItem.ID;
            //Assert
            id.Should().Be(Tests.FAKE_JEWELRY_REPOSITORY_FIRST_ITEM_ID);
        }
        public JewelCartItem JewelCartItem(int id, string size, JewelMediaType mediaType)
        {
            var jewel = jewelRepository.GetJewelByID(id);
            var price = jewel.Price;

            var cartItem = new JewelCartItem(id, mediaType,(decimal) price);
            if (!String.IsNullOrWhiteSpace(size))
            {
                cartItem.SetSize(size);
            }

            return cartItem;
        }
        public JewelCartItem JewelCartItem(int id, string size, JewelMediaType mediaType)
        {
            var jewel = jewelRepository.GetJewelByID(id);
            var price = jewel.Price;

            var cartItem = new JewelCartItem(id, mediaType, (decimal)price);

            if (!String.IsNullOrWhiteSpace(size))
            {
                cartItem.SetSize(size);
            }

            return(cartItem);
        }
Exemplo n.º 6
0
 public static JewelCartItem FakeJewelCartItem(int id, string size, JewelMediaType mediaType,decimal price)
 {
     var cartItem = new JewelCartItem(id, mediaType,price);
     cartItem.SetSize(size);
     return cartItem;
 }