public void GetPaymentMethodsTest() { //Arrange DataCustomerOrder dataCustomerOrder = new DataCustomerOrder(); //Act List <ServicePaymentMethod> paymentMethods = (List <ServicePaymentMethod>)dataCustomerOrder.GetPaymentMethods(); //Assert Assert.IsTrue(paymentMethods.Count() >= 1); }
public void TestGetAllOrders() { // Arrange DataCustomerOrder dataOrder = new DataCustomerOrder(); // Act List <ServiceCustomerOrder> orders = (List <ServiceCustomerOrder>)dataOrder.GetAllOrders(); //Assert Assert.IsTrue(orders.Count >= 1); }
public void TestCancelOrder() { //Arrange DataCustomerOrder dataOrder = new DataCustomerOrder(); ServiceCustomerOrder order = new ServiceCustomerOrder(); // Get the first order in the DB order = dataOrder.GetOrder(1); // Change the order status to Cancelled order.Status = "Cancelled"; //Act dataOrder.UpdateOrder(order); // Update the order and update the database //Assert Assert.AreEqual("Cancelled", dataOrder.GetOrder(1).Status); }
public void InsertOrderTest() { //Arrange DataProduct dataProduct = new DataProduct(); DataCustomerOrder dataCustomerOrder = new DataCustomerOrder(); ServiceCustomer customer = new ServiceCustomer(); customer.Name = "Peter J."; customer.Address = "Sofiendalsvej"; customer.ZipCode = 9000; customer.PhoneNo = "12345678"; ServiceProduct product = new ServiceProduct(); product = dataProduct.GetProductById(4); ServiceProductLine productLine = new ServiceProductLine(); productLine.Amount = 1; productLine.SubTotal = product.Price; productLine.Product = product; ServiceCustomerOrder order = new ServiceCustomerOrder(); order.FinalPrice = productLine.SubTotal; order.Status = "Active"; order.DateOrder = DateTime.Now; order.PaymentMethod = 1; order.DiscountCode = null; List <ServiceProductLine> productLines = new List <ServiceProductLine>(); productLines.Add(productLine); order.ShoppingCart = productLines; //Act bool success = dataCustomerOrder.FinishCheckout(order); //Assert Assert.IsTrue(success); }
public void SetPaymentMethodTest() { //Arrange ServiceCustomerOrder order = new ServiceCustomerOrder(); DataCustomerOrder dco = new DataCustomerOrder(); ServiceCustomerOrder testOrder; order.DateOrder = DateTime.Today; order.FinalPrice = 5000; order.Status = "Test Status"; order.PaymentMethod = 1; order.CustomerId = 1; //Act int idOfTestOrder = dco.InsertOrder(order); testOrder = dco.GetOrder(idOfTestOrder); //Assert Assert.IsNotNull(testOrder.PaymentMethod); }
public void OrderWithoutDiscount() { //ARRANGE ServiceCustomerOrder order = new ServiceCustomerOrder(); DataCustomerOrder dco = new DataCustomerOrder(); ServiceCustomerOrder testOrder = new ServiceCustomerOrder(); // Set all attributes except Discount order.DateOrder = DateTime.Today; order.FinalPrice = 1000; order.Status = "Test Status"; order.PaymentMethod = 1; order.CustomerId = 1; //ACT int testId = dco.InsertOrder(order); testOrder = dco.GetOrder(testId); //ASSERT Assert.IsNotNull(testOrder); }
public CustomerOrderControl() { dataCustomerOrder = new DataCustomerOrder(); }