Exemplo n.º 1
0
        public void ThrowArgumentNullException_WhenInvalidICartIdentifierParameterIsPassed()
        {
            // Arrange
            Mock <IShoppingCart> shoppingCartMock   = new Mock <IShoppingCart>();
            ICartIdentifier      cartIdentifierMock = null;

            // Act && Assert
            Assert.That(() => new ShoppingCartController(shoppingCartMock.Object, cartIdentifierMock),
                        Throws.TypeOf <ArgumentNullException>());
        }
Exemplo n.º 2
0
        public AccountController(IShoppingCart shoppingCart, ICartIdentifier cardIdentifier)
        {
            if (shoppingCart == null)
            {
                throw new ArgumentNullException();
            }

            if (cardIdentifier == null)
            {
                throw new ArgumentNullException();
            }


            this.shoppingCart   = shoppingCart;
            this.cardIdentifier = cardIdentifier;
        }
Exemplo n.º 3
0
        public CheckoutController(
            IShoppingCart shoppingCart,
            IOrderFactory orderFactory,
            ICartIdentifier cardIdentifier)
        {
            if (shoppingCart == null)
            {
                throw new ArgumentNullException(nameof(shoppingCart));
            }

            if (orderFactory == null)
            {
                throw new ArgumentNullException(nameof(orderFactory));
            }

            if (cardIdentifier == null)
            {
                throw new ArgumentNullException(nameof(cardIdentifier));
            }

            this.shoppingCart   = shoppingCart;
            this.orderFactory   = orderFactory;
            this.cardIdentifier = cardIdentifier;
        }