public void Which_product_can_buy_in_special_cash() { // Arrange Shop shop = _shops[0]; shop.AddConsignment(_products[2], 10, 10); shop.AddConsignment(_products[4], 10, 101); shop.AddConsignment(_products[6], 10, 90); // Act List <(Product, int)> result = shop.CountProductsForSum(100); // Assert Assert.IsTrue(result.Count() == 2); Assert.IsTrue(result.FirstOrDefault(x => x.Item1.Id == _products[2].Id).Item2 == 10); Assert.IsTrue(result.FirstOrDefault(x => x.Item1.Id == _products[6].Id).Item2 == 1); }
public void Product_availble_after_add_consigment() { // Arrange Shop shop = _shops[0]; Product product = _products[0]; // Act shop.AddConsignment(product, 10, 10); // Assert Assert.IsTrue(shop.TryGetMinPrice(product, out decimal price)); }
public void Bye_consigment_in_Shop() { // Arrange Shop shop = _shops[0]; shop.AddConsignment(_products[5], 4, 10); shop.AddConsignment(_products[8], 1, 10); List <(Product, int)> shopList = new List <(Product, int)> { (_products[5], 2), (_products[8], 1) }; decimal expectedSum = 30; // Act bool result = shop.TryBuyProducts(shopList, out decimal actualSum); // Assert Assert.IsTrue(result); Assert.IsTrue(expectedSum == actualSum); }