public void BuyProductShouldThrownExceptionWhenNotExistProduct(string name) { Assert.Throws <ArgumentNullException>(() => { _storeManager.BuyProduct(name, 1); }); }
public void BuyingMoreThanExistingProductsShouldThrowException() { StoreManager manager = new StoreManager(); Product product = new Product("Test", 20, 10); manager.AddProduct(product); manager.BuyProduct("Test", 20); Assert.Throws <ArgumentException>(() => manager.BuyProduct("Test", 20)); }
public void StoreManagerBuyProductCorrect() { Product productToBuy = new Product("Z", 5, 1); StoreManager manager = new StoreManager(); manager.AddProduct(productToBuy); manager.BuyProduct(productToBuy.Name, 1); Assert.AreEqual(4, productToBuy.Quantity); }
public void BuyNullProductShouldThrowException() { StoreManager storeManager = new StoreManager(); Assert.Throws <ArgumentNullException>(() => { storeManager.BuyProduct("asd", 1); }); }
public void Buy_Product_Should_Throw_An_Exception_If_The_Product_Quantity_Is_Bellow_Than_The_Wanted_Quantity() { var storeManager = new StoreManager(); storeManager.AddProduct(new Product("Pizza", 10, 0.1m)); Assert.Throws <ArgumentException>( () => storeManager.BuyProduct("Pizza", 46), "The product qty is not bellow than the wanted quantity."); }
public void Buy_Product_Should_Return_Correct_Product_Price() { var storeManager = new StoreManager(); storeManager.AddProduct(new Product("Pizza", 10, 0.1m)); var price = storeManager.BuyProduct("Pizza", 5); Assert.That(price, Is.EqualTo(0.5)); }
public void Buy_Product_Should_Throw_An_Exception_If_The_Product_Is_Null() { var storeManager = new StoreManager(); storeManager.AddProduct(new Product("Pizza", 10, 0.1m)); Assert.Throws <ArgumentNullException>( () => storeManager.BuyProduct("Salamka", 65), "The product is not null."); }
public void BuyingNullProductShouldThrowException() { StoreManager manager = new StoreManager(); Product product = new Product("Test", 20, 10); manager.AddProduct(product); Assert.Throws <ArgumentNullException>(() => manager.BuyProduct(null, 20)); }
public void BuyProductShouldSubtractQuantity() { StoreManager storeManager = new StoreManager(); Product product = new Product("produkt", 3, 2.50m); storeManager.AddProduct(product); storeManager.BuyProduct("produkt", 1); Assert.AreEqual(product.Quantity, 2); }
public void BuyProductWithoutEnoughQtyShouldThrowException() { StoreManager storeManager = new StoreManager(); Product product = new Product("produkt", 2, 2.50m); storeManager.AddProduct(product); Assert.Throws <ArgumentException>(() => { storeManager.BuyProduct("produkt", 3); }, "There is not enough quantity of this product."); }
public void BuyProductShgouldThrowExcQuantity() { StoreManager sm = new StoreManager(); Product product = new Product("Lenovo", 100, 1500.50m); Product product2 = new Product("Lenovoooooo", 100000, 150000.50m); sm.AddProduct(product); sm.AddProduct(product2); Assert.Throws <ArgumentException>(() => sm.BuyProduct("Lenovo", 10000000)); }
public void TestBuyProduct() { var product = new Product("Pesho", 10, 2m); var store = new StoreManager(); store.AddProduct(product); store.BuyProduct("Pesho", 2); Assert.AreEqual(8, product.Quantity); }
public void BuyProductShouldWork() { StoreManager storeManager = new StoreManager(); Product product = new Product("produkt", 3, 2.50m); storeManager.AddProduct(product); storeManager.BuyProduct("produkt", 1); decimal finalPrice = product.Price * 1; Assert.AreEqual(product.Price * 1, finalPrice); }
public void TestBuyProductQuantityException() { var product = new Product("Pesho", 5, 5.5m); var store = new StoreManager(); store.AddProduct(product); Assert.Throws <ArgumentException>(() => { store.BuyProduct("Pesho", 30); }); }
public void MethodBuyProductShouldThrowExceptionIfDesiredQuantityIsMoreThanActualQuantity() { //Arrange StoreManager storeManager = new StoreManager(); Product product = new Product("Product", 20, 50); //Act storeManager.AddProduct(product); //Assert Assert.Throws <ArgumentException>(() => storeManager.BuyProduct("Product", 30)); }
public void BuyProductShouldReturnCorrectProduct() { StoreManager sm = new StoreManager(); Product product = new Product("Lenovo", 100, 1500m); Product product2 = new Product("Lenovoooooo", 100000, 150000.50m); sm.AddProduct(product); sm.AddProduct(product2); sm.BuyProduct("Lenovo", 50); Assert.AreEqual("Lenovo", product.Name); }
public void BuyProductQuantityBeCorrect() { StoreManager sm = new StoreManager(); Product product = new Product("Lenovo", 100, 1500m); Product product2 = new Product("Lenovoooooo", 100000, 150000.50m); sm.AddProduct(product); sm.AddProduct(product2); sm.BuyProduct("Lenovo", 50); Assert.AreEqual(50, product.Quantity); }
public void MethodBuyProductShouldThrowExceptionIfProductWithGivenNameIsNull() { //Arrange StoreManager storeManager = new StoreManager(); Product product = new Product("Product", 20, 50); //Act storeManager.AddProduct(product); //Assert Assert.Throws <ArgumentNullException>(() => storeManager.BuyProduct("Product2", 20)); }
public void MethodBuyProductShouldCalculateAndReturnCorrectFinalPrice() { //Arrange StoreManager storeManager = new StoreManager(); Product product = new Product("Product", 20, 50); //Act storeManager.AddProduct(product); decimal expectedResult = 500; decimal actualResult = storeManager.BuyProduct("Product", 10); //Assert Assert.AreEqual(expectedResult, actualResult); }
public void MethodBuyProductShouldDecreaseProductQuantityIfCorrectDataIsGiven() { //Arrange StoreManager storeManager = new StoreManager(); Product product = new Product("Product", 20, 50); //Act storeManager.AddProduct(product); storeManager.BuyProduct("Product", 10); int expectedResult = 10; int actualResult = product.Quantity; //Assert Assert.AreEqual(expectedResult, actualResult); }
public void BuyProductShouldReduceCurrentQuantityWithGivenQuantity() { string name = "Butter"; int quantity = 10; decimal price = 5m; Product product = new Product(name, quantity, price); StoreManager manager = new StoreManager(); manager.AddProduct(product); manager.BuyProduct(product.Name, 6); Assert.That(product.Quantity == 4); }
public void BuyProductShouldReturnFinalPrice() { string name = "Butter"; int quantity = 10; decimal price = 100m; decimal expectedPrice = price * 6; Product product = new Product(name, quantity, price); StoreManager manager = new StoreManager(); manager.AddProduct(product); var actualPrice = manager.BuyProduct(product.Name, 6); Assert.That(actualPrice == expectedPrice); }
public void BuyingShouldCalculateProperly() { StoreManager manager = new StoreManager(); Product product = new Product("Test", 20, 10); Product product1 = new Product("Test1", 30, 20); manager.AddProduct(product); manager.AddProduct(product1); manager.BuyProduct("Test", 20); var expectedTotalQuantity = 0; var expectedFinalPrice = 0; Assert.AreEqual(expectedTotalQuantity, product.Quantity); Assert.AreEqual(expectedFinalPrice, product.Quantity * product.Price); }
public void BuyProductShouldThrowExceptionWhenProductIsNull() { string name = "Butter"; int quantity = 10; decimal price = 5m; Product product = new Product(name, quantity, price); StoreManager manager = new StoreManager(); manager.AddProduct(product); Assert.Throws <ArgumentNullException>(() => { manager.BuyProduct("Washmachine", 5); }); }
public void BuyProductShouldThrowExceptionWhenQuantityIsMoreThanCurrentQuantity() { string name = "Butter"; int quantity = 10; decimal price = 5m; Product product = new Product(name, quantity, price); StoreManager manager = new StoreManager(); manager.AddProduct(product); Assert.Throws <ArgumentException>(() => { manager.BuyProduct(product.Name, 11); }); }
public void BuyProductShouldThrowExceptionWhenProductIsNull() { Assert.Throws <ArgumentNullException>(() => storeManager.BuyProduct("a", 3)); }
public void ThrowArgumentNullExceptionIfProductToBuyIsNull() { Assert.Throws <ArgumentNullException>(() => storeManager.BuyProduct("Nik", 10)); }
public void StoreManagerBuyProductNull() { Product productTest = new Product("nqma go", 10, 20); Assert.Throws <ArgumentNullException>(() => storeManager.BuyProduct(productTest.Name, 1)); }