public void UpdateProduct() { ProductManager productManager = new ProductManager("BangazonTestDB"); CustomerManager customerManager = new CustomerManager("BangazonTestDB"); Customer newCust = customerManager.Add(_customer2); customerManager.ActivateCustomer(newCust.Id); Product _product2 = new Product( customerManager.ActiveCustomer.Id, 45.27, "Movie", "Instructional Film about See Sherp", 8, 0, dt ); List <Product> listProduct = productManager.GetAllProducts(); List <Product> filteredList = productManager.FilteredProducts(customerManager.ActiveCustomer.Id, listProduct); Product productToEdit = productManager.GetSingleProduct(2); Product updatedProduct1 = productManager.UpdatePrice(productToEdit, 38.99); Product updatedProduct2 = productManager.UpdateTitle(productToEdit, "Bonkers"); Product updatedProduct3 = productManager.UpdateDescription(productToEdit, "Cows are Nuts"); Product updatedProduct4 = productManager.UpdateQuantity(productToEdit, 2); Assert.Equal(38.99, updatedProduct1.Price); Assert.Equal("Bonkers", updatedProduct2.Name); Assert.Equal("Cows are Nuts", updatedProduct3.Description); Assert.Equal(2, updatedProduct4.Quantity); }
public void ListAllProducts() { ProductManager productmanager = new ProductManager("BangazonTestDB"); CustomerManager customerManager = new CustomerManager("BangazonTestDB"); Customer newCust = customerManager.Add(_customer2); customerManager.ActivateCustomer(newCust.Id); Product _product2 = new Product( customerManager.ActiveCustomer.Id, 45.27, "Movie", "Instructional Film about See Sherp", 8, 0, dt ); List <Product> listProduct = productmanager.GetAllProducts(); bool movieExists = false; foreach (Product p in listProduct) { if (p.Name == "Movie") { movieExists = true; } } Assert.True(movieExists); }
public void CompleteOrder() { _paymentType = new PaymentType( 1, "12", "Visa", 1 ); CustomerManager customerManager = new CustomerManager("BangazonTestDB"); OrderManager orderManager = new OrderManager("BangazonTestDB"); Customer newCust = customerManager.Add(_customer2); customerManager.ActivateCustomer(newCust.Id); _order = new Order( customerManager.ActiveCustomer.Id, 0, _dt ); Order thatOrder = orderManager.StoreOrder(_order); Order newOrd = orderManager.CompleteOrder(thatOrder.Id, _paymentType.Id); Order updatedOrder = orderManager.GetSingleOrder(newOrd.Id); Assert.Equal(_paymentType.Id, updatedOrder.PaymentId); }
public void ActivateCustomer_Should() { CustomerManager manager = new CustomerManager("BangazonTestDB"); manager.Add(_customer1); manager.ActivateCustomer(1); Assert.Equal(1, manager.ActiveCustomer.Id); }
public void AddPaymentType_Should() { CustomerManager custManager = new CustomerManager("BangazonTestDB"); PaymentTypeManager manager = new PaymentTypeManager("BangazonTestDB"); Customer newCust = custManager.Add(_customer); custManager.ActivateCustomer(newCust.Id); PaymentType _paymentType2 = new PaymentType( "AMEX", "172635", custManager.ActiveCustomer.Id ); PaymentType newPaymentType = manager.AddPaymentType(_paymentType2); Assert.Equal("AMEX", newPaymentType.Name); Assert.Equal(custManager.ActiveCustomer.Id, newPaymentType.CustomerId); }
public void CreateNewOrder() { CustomerManager customerManager = new CustomerManager("BangazonTestDB"); OrderManager orderManager = new OrderManager("BangazonTestDB"); customerManager.Add(_customer); customerManager.ActivateCustomer(_customer.Id); _order = new Order( 1, customerManager.ActiveCustomer.Id, 0, _dt ); Order updatedOrder = orderManager.StoreOrder(_order); Assert.Equal(customerManager.ActiveCustomer.Id, updatedOrder.CustomerId); }
public void addProductToOrder() { CustomerManager customerManager = new CustomerManager("BangazonTestDB"); ProductManager productManager = new ProductManager("BangazonTestDB"); OrderManager orderManager = new OrderManager("BangazonTestDB"); Customer newCust = customerManager.Add(_customer2); customerManager.ActivateCustomer(newCust.Id); Order newOrder = new Order( customerManager.ActiveCustomer.Id, dt ); Order newestOrder = orderManager.StoreOrder(newOrder); Product _product2 = new Product( customerManager.ActiveCustomer.Id, 45.27, "Movie", "Instructional Film about See Sherp", 8, 0, dt ); Product newProduct = productManager.Add(_product2); ProductOrderJoin newPOJ = new ProductOrderJoin( newestOrder.Id, newProduct.Id ); ProductOrderJoin freshPOJ = productManager.storeProductOrderJoin(newPOJ); Assert.Equal(newestOrder.Id, freshPOJ.OrderId); }
public ActionResult CustomerActivate(Guid id) { CustomerManager cm = new CustomerManager(); BusinessLayerResult <Customer> res = cm.ActivateCustomer(id); if (res.Errors.Count > 0) { ErrorViewModel ErrnotifyObj = new ErrorViewModel() { Title = "Geçersiz İşlem", Items = res.Errors }; return(View("Error", ErrnotifyObj)); } OkViewModel OkntfyObj = new OkViewModel() { Title = "Hesap Aktifleştiridi.", RedirectingUrl = "/Home/CustomerLogin/" }; OkntfyObj.Items.Add("Hesabınız Aktifleştiridi.. Aramıza Hoşgeldin !"); return(View("Ok", OkntfyObj)); }
public void AddProduct() { CustomerManager customerManager = new CustomerManager("BangazonTestDB"); ProductManager productmanager = new ProductManager("BangazonTestDB"); Customer newCust = customerManager.Add(_customer2); customerManager.ActivateCustomer(newCust.Id); Product _product2 = new Product( customerManager.ActiveCustomer.Id, 45.27, "Movie", "Instructional Film about See Sherp", 8, 0, dt ); Product newProduct = productmanager.Add(_product2); Assert.Equal("Movie", newProduct.Name); }
public void FilterProduct_Should() { ProductManager productmanager = new ProductManager("BangazonTestDB"); CustomerManager customerManager = new CustomerManager("BangazonTestDB"); Customer newCust = customerManager.Add(_customer2); customerManager.ActivateCustomer(newCust.Id); Product _product2 = new Product( customerManager.ActiveCustomer.Id, 45.27, "Movie", "Instructional Film about See Sherp", 8, 0, dt ); List <Product> listProduct = productmanager.GetAllProducts(); List <Product> filteredList = productmanager.FilteredProducts(customerManager.ActiveCustomer.Id, listProduct); foreach (Product p in filteredList) { Assert.Equal(p.CustomerId, customerManager.ActiveCustomer.Id); } }