Example #1
0
        public void MakeCustomerDeposit_AmountBiggerTanProducts_ExceptionThrown()
        {
            // arrange
            var product = Product.MakeProduct("Test product", "Test product", 15, Dimensions.MakeDimensions(11, 12, 13));

            product.UpdateAmount(15);
            var customer      = Customer.MakeCustomer("Julio", "05908990078", DateTime.Now);
            var customerOrder = CustomerOrder.MakeCustomerOrder(5, customer);

            customerOrder.AddItem(product, 5);

            // act
            Assert.Throws <ArgumentException>(() => CustomerDeposit.MakeCustomerDeposit(customerOrder.CustomerOrderItems.First(), 20, DepositMovement.Out));
        }
Example #2
0
        public void DeleteCustomerDeposit_ValidParameters_ExceptionThrown()
        {
            // arrange
            var product = Product.MakeProduct("Test product", "Test product", 15, Dimensions.MakeDimensions(11, 12, 13));

            product.UpdateAmount(15);
            var customer      = Customer.MakeCustomer("Julio", "05908990078", DateTime.Now);
            var customerOrder = CustomerOrder.MakeCustomerOrder(5, customer);

            customerOrder.AddItem(product, 5);
            var customerDeposit = CustomerDeposit.MakeCustomerDeposit(customerOrder.CustomerOrderItems.First(), 5, DepositMovement.Out);

            // act
            Assert.Throws <InvalidOperationException>(() => customerDeposit.Delete());
        }
Example #3
0
        public void MakeCustomerDeposit_ValidParameters_DepositCreated()
        {
            // arrange
            var product = Product.MakeProduct("Test product", "Test product", 15, Dimensions.MakeDimensions(11, 12, 13));

            product.UpdateAmount(15);
            var customer      = Customer.MakeCustomer("Julio", "05908990078", DateTime.Now);
            var customerOrder = CustomerOrder.MakeCustomerOrder(5, customer);

            customerOrder.AddItem(product, 5);

            // act
            var customerDeposit = CustomerDeposit.MakeCustomerDeposit(customerOrder.CustomerOrderItems.First(), 5, DepositMovement.Out);

            // assert
            Assert.Equal(customerDeposit.Amount, 5);
            Assert.Equal(customerDeposit.Sku, product.Sku);
        }
Example #4
0
 public void MakeCustomerDeposit_NullCustomerOrderItem_ExceptionThrown()
 {
     // act
     Assert.Throws <ArgumentNullException>(() => CustomerDeposit.MakeCustomerDeposit(null, 5, DepositMovement.Out));
 }