public IActionResult OrderTrack(TrackOrderModel modelIn) { var orderServices = new OrderServices(); //methods var orderDateServices = new OrderDataServices(); //database bool emailValidation = orderServices.IsEmailValid(modelIn.EmailAddress); if (emailValidation == false) { ModelState.AddModelError(string.Empty, "Invalid Email"); } bool orderNumberValidation = orderServices.IsOrderNumberValid(modelIn.OrderNumber); if (orderNumberValidation == false) { ModelState.AddModelError(string.Empty, "Invalid Order Number"); } if (emailValidation == false || orderNumberValidation == false) { return(View(modelIn)); } string orderStatus = orderServices.GetOrderDetails(modelIn.EmailAddress, modelIn.OrderNumber, orderDateServices); OrderStatusModel orderStatusModel = new OrderStatusModel(); orderStatusModel.OrderStatus = orderStatus; return(View("OrderStatus", orderStatusModel)); }
public void OrderDetails_OrderShipped_Ontheway() { //Arrange string result; var orderDataServices = new OrderDataServices(); var orderService = new OrderServices(); //Act result = orderService.GetOrderDetails("*****@*****.**", "123", orderDataServices); //Assert Assert.IsTrue(result.StartsWith("Shipped")); }
public void OrderDetails_OrderShipped_OrderNotFound() { //Arrange string result; var orderDataServices = new OrderDataServices(); var orderService = new OrderServices(); //Act result = orderService.GetOrderDetails("*****@*****.**", "789", orderDataServices); //Assert Assert.AreEqual(result, "Order not found"); }