public void AddProductWhenNullShouldThrowException() { webshop = new MyWebshop(basket = new Basket()); Product p = null; Assert.Throws <IncorrectProductException>(() => webshop.Basket.AddProduct(p, 2), "Product can not be null"); }
public void AddProductWithPriceZeroShouldThrowException() { webshop = new MyWebshop(basket = new Basket()); Product p = new Product() { }; Assert.Throws <IncorrectPriceException>(() => webshop.Basket.AddProduct(p, 2), "Price can not be 0"); }
public void AddingProductWithoutPriceShouldThrowException() { webshop = new YarnWebshop(basket = new Basket()); Product p = new Product() { Price = 0 }; Assert.Throws <WrongPriceException>(() => webshop.Basket.AddProduct(p, 1), "Productpricing is zero"); }
public void AddProductWithNegativeAmountShouldThrowException() { webshop = new MyWebshop(basket = new Basket()); Product p = new Product() { Price = 20.00m }; Assert.Throws <IncorrectAmountException>(() => webshop.Basket.AddProduct(p, -1), "Amount must be above 0"); }
public void AddProductWithoutPriceShouldThrowException() { webshop = new MyWebshop(basket = new Basket()); Product p = new Product() { Price = -0.01M }; Assert.Throws <IncorrectPriceException>(() => webshop.Basket.AddProduct(p, 2), "Price can not be empty"); }
public void AddingProductWithoutValidPriceShouldThrowException(int amount) { webshop = new YarnWebshop(basket = new Basket()); Product p = new Product() { Price = 300m }; webshop.Basket.AddProduct(p, amount); Assert.AreEqual(p.Price * amount, webshop.Basket.TotalCost, "Productpricing is wrong"); }
public void AddingProductWithValidPriceAndFormatShouldBeSuccessful() { webshop = new YarnWebshop(basket = new Basket()); Product p = new Product() { Price = 300m }; webshop.Basket.AddProduct(p, 3); Assert.AreEqual(p.Price * 3, webshop.Basket.TotalCost, "Product should be added"); }
public void RemovingToManyShouldThrowException() { webshop = new YarnWebshop(basket = new Basket()); Product p = new Product() { Price = 150.00m }; webshop.Basket.AddProduct(p, 2); Assert.Throws <WrongProductRemovalException>(() => webshop.Basket.RemoveProduct(p, 4), "Should be removed"); }
public void AddProductShouldSucceedAddToList(int amount) { webshop = new MyWebshop(basket = new Basket()); Product p = new Product() { Price = 20.00m }; webshop.Basket.AddProduct(p, amount); Assert.AreEqual(p.Price * amount, webshop.Basket.TotalCost, "Does not match"); }
public void CheckOutWhenIBillingIsNullIsNullShouldThrowException() { webshop = new MyWebshop(basket = new Basket()); Product p = new Product() { Price = 10.00m }; webshop.Basket.AddProduct(p, 2); Assert.Throws <IncorrectBillingException>(() => webshop.Checkout(null), "Basket should need a billing."); }
public void NotEnoughCashShouldThrowException() { webshop = new MyWebshop(basket = new Basket()); Product p = new Product() { Price = 10.00m }; webshop.Basket.AddProduct(p, 2); Assert.Throws <NotEnoughCashException>(() => webshop.Checkout(billing = new MockBilling(19.00m)), "You should not have enough cash"); }
public void RemoveZeroProductShouldThrowException() { webshop = new MyWebshop(basket = new Basket()); Product p = new Product() { Price = 10.00m }; webshop.Basket.AddProduct(p, 2); Assert.Throws <IncorrectActionException>(() => webshop.Basket.RemoveProduct(p, 0), "Should not be able to remove zero products"); }
public void RemoveMoreProductsThanInBasketShouldThrowException() { webshop = new MyWebshop(basket = new Basket()); Product p = new Product() { Price = 10.00m }; webshop.Basket.AddProduct(p, 2); Assert.Throws <IncorrectActionException>(() => webshop.Basket.RemoveProduct(p, 3), "Should work"); }
public void CheckoutWithBillingNullShouldThrowException() { webshop = new YarnWebshop(basket = new Basket()); Product p = new Product() { Price = 295.00m }; webshop.Basket.AddProduct(p, 4); Assert.Throws <WrongBillingException>(() => webshop.Checkout(null), "Basket should be billed first"); }
public void RemoveProductShouldSucceed(int amount) { webshop = new MyWebshop(basket = new Basket()); Product p = new Product() { Price = 10.00m }; webshop.Basket.AddProduct(p, amount); webshop.Basket.RemoveProduct(p, amount); Assert.That(webshop.Basket.TotalCost, Is.EqualTo(0), "Should be the same"); }
public void TooLittleOnBalanceShouldThrowException() { webshop = new YarnWebshop(basket = new Basket()); Product p = new Product() { Price = 295.00m }; webshop.Basket.AddProduct(p, 4); var newbalance = billing.Balance; Assert.Throws <InsufficientFundsException>(() => webshop.Checkout(billing = new MockBilling(600m)), "Money should not be sufficient"); }
public void AllValidCheckoutShouldBeSuccessful() { webshop = new YarnWebshop(basket = new Basket()); Product p = new Product() { Price = 295.00m }; webshop.Basket.AddProduct(p, 4); webshop.Checkout(billing = new MockBilling(1180m)); var newbalance = billing.Balance; Assert.AreEqual(0, newbalance, "Money should cover billing"); }
static void Main(string[] args) { SzamtechBolt szb = new SzamtechBolt(); //szb.GetArlista(); ((IUzlet)szb).GetArlista(); IWebshop ws = szb; ws.GetArlista(); Console.ReadLine(); }
public void EnoughCashShouldSucceed() { webshop = new MyWebshop(basket = new Basket()); Product p = new Product() { Price = 10.00m }; webshop.Basket.AddProduct(p, 2); webshop.Checkout(billing = new MockBilling(21.00m)); var currentBalance = billing.Balance; Assert.AreEqual(1.00m, currentBalance, "You should have enough cash"); }
public void CreateMyWebshopWhenBasketIsNullShouldThrowException() { Assert.Throws <IncorrectBasketException>(() => webshop = new MyWebshop(null), "Webshop should need a basket."); }
public void CreateMyWebshopWhenBasketIsNullShouldThrowException() { Assert.Throws <MissingBasketException>(() => webshop = new YarnWebshop(null), "Webshop has no basket yet."); }