public void AutoCompleteProductForOneStore_FourProductsInListThatStartsWithB_ThirdProductIsInReturnedList() { var aldiStoreName = "Aldi"; var bananProductAndPrice = new ProductAndPrice() { Name = "Banan" }; var baconProductAndPrice = new ProductAndPrice() { Name = "Bacon" }; var bollerProductAndPrice = new ProductAndPrice() { Name = "Boller" }; var brombaerProductAndPrice = new ProductAndPrice() { Name = "Brombaer" }; _productAndPrices.Add(bananProductAndPrice); _productAndPrices.Add(baconProductAndPrice); _productAndPrices.Add(bollerProductAndPrice); _productAndPrices.Add(brombaerProductAndPrice); _unitWork.Stores.FindProductsInStoreStartingWith(aldiStoreName, "B").Returns(_productAndPrices); Assert.That(_uut.AutoCompleteProductForOneStore(aldiStoreName, "B").Contains(bollerProductAndPrice.Name), Is.EqualTo(true)); }
public void ChangeItemToAnotherStores_ChangeFromLidlToAldiWhenItemExistInAldi_returns1() { StoreProductAndPrice storeProductAndPrice = new StoreProductAndPrice() {Price = 2, ProductName = "Test", Quantity = "2", StoreName = "Lidl"}; _uut.GeneratedShoppingListData.Add(storeProductAndPrice); ProductAndPrice productAndPrice = new ProductAndPrice() {Price = 3, Name = "Aldi"}; _unitWork.Stores.FindProductInStore("Aldi", storeProductAndPrice.ProductName).Returns(productAndPrice); List<StoreAndPrice> storeAndPriceList = new List<StoreAndPrice>(); StoreAndPrice storeAndPrice = new StoreAndPrice{Price = 6, Name = _store.StoreName}; storeAndPriceList.Add(storeAndPrice); _unitWork.Products.FindCheapestStoreForAllProductsWithSum(Arg.Any<List<ProductInfo>>()) .Returns(storeAndPriceList); _uut.ShoppingListData.Add(new ProductInfo(_product.ProductName, "2")); Assert.That(_uut.ChangeProductToAnotherStore("Aldi", storeProductAndPrice), Is.EqualTo(1)); }
public void AutoCompleteProductForOneStore_LookUpWordStartsWithB_ReturnsListOfSize1() { var aldiStoreName = "Aldi"; var bananProductAndPrice = new ProductAndPrice() { Name = "Banan" }; _productAndPrices.Add(bananProductAndPrice); _unitWork.Stores.FindProductsInStoreStartingWith(aldiStoreName, "B").Returns(_productAndPrices); Assert.That(_uut.AutoCompleteProductForOneStore(aldiStoreName, "B").Count, Is.EqualTo(1)); }
public void AutoCompleteProductForOneStore_SortList_ListIsSortedCheckTwo() { var aldiStoreName = "Aldi"; var bananProductAndPrice = new ProductAndPrice() { Name = "Banan" }; var baconProductAndPrice = new ProductAndPrice() { Name = "Bacon" }; var bollerProductAndPrice = new ProductAndPrice() { Name = "Boller" }; var brombaerProductAndPrice = new ProductAndPrice() { Name = "Brombaer" }; _productAndPrices.Add(brombaerProductAndPrice); _productAndPrices.Add(bananProductAndPrice); _productAndPrices.Add(baconProductAndPrice); _productAndPrices.Add(bollerProductAndPrice); _unitWork.Stores.FindProductsInStoreStartingWith(aldiStoreName, "B").Returns(_productAndPrices); Assert.That(_uut.AutoCompleteProductForOneStore(aldiStoreName, "B")[1], Is.EqualTo("Banan")); }