public void GetDeliveryDetailsTest() { try { List <ShoppingCart> details = new List <ShoppingCart> { shoppingCart }; Delivery delivery = shoppingService.CreateDelivery(new decimal(9.99), creditCard.cardNumber, user.usrId, "Short description", details); DeliveryLineBlock foundDetails = shoppingService.GetDeliveryDetails(delivery.deliveryId); Assert.AreEqual(1, foundDetails.DeliveryLines.Count); Assert.AreEqual(shoppingCart.Amount, foundDetails.DeliveryLines[0].DeliveryLineAmount); Assert.AreEqual(product.productPrice, foundDetails.DeliveryLines[0].DeliveryLinePrice); Assert.AreEqual(product.productName, foundDetails.DeliveryLines[0].ProductName); Assert.IsFalse(foundDetails.ExistMoreDeliveryLines); } catch (Exception) { Assert.Fail(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int startIndex, count; int deliveryId = Int32.Parse(Request.Params.Get("deliveryId")); lnkPrevious.Visible = false; lnkNext.Visible = false; /* Get Start Index */ try { startIndex = Int32.Parse(Request.Params.Get("startIndex")); } catch (ArgumentNullException) { startIndex = 0; } /* Get Count */ try { count = Int32.Parse(Request.Params.Get("count")); } catch (ArgumentNullException) { count = Settings.Default.PracticaMaD_defaultCount; } /* Get Deliveries Info */ DeliveryLineBlock deliveryBlock = SessionManager.GetAllDeleviryLines(deliveryId, startIndex, count); this.gvDeliverie.DataSource = deliveryBlock.DeliveryLines; this.gvDeliverie.DataBind(); /* "Previous" link */ if ((startIndex - count) >= 0) { String url = "~/Pages/Shopping/DeliveryDetails.aspx?" + "&deliveryId=" + deliveryId + " &startIndex=" + (startIndex - count) + "&count=" + count; this.lnkPrevious.NavigateUrl = Response.ApplyAppPathModifier(url); this.lnkPrevious.Visible = true; } /* "Next" link */ if (deliveryBlock.ExistMoreDeliveryLines) { String url = "~/Pages/Shopping/DeliveryDetails.aspx?" + "&deliveryId=" + deliveryId + "&startIndex=" + (startIndex + count) + "&count=" + count; this.lnkNext.NavigateUrl = Response.ApplyAppPathModifier(url); this.lnkNext.Visible = true; } } }