public void RetrieveOrderDisplayTest() { // Arrange var orderRepository = new OrderRepository(); var expected = new OrderDisplay() { FirstName = "Bilbo", LastName = "Baggins", OrderDate = new DateTimeOffset(2014, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)), ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bag End", StreetLine2 = "Bagshot Row", City = "Hobbiton", State = "Shire", Country = "Middle Earth", PostalCode = "144" }, OrderDisplayItemList = new List <OrderDisplayItem>() { new OrderDisplayItem() { OrderQuantity = 2, ProductName = "Sunflowers", PurchasePrice = 15.96M }, new OrderDisplayItem() { OrderQuantity = 1, ProductName = "Rake", PurchasePrice = 6M } } }; // Act var actual = orderRepository.RetrieveOrderDisplay(10); // Assert Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.OrderDate, actual.OrderDate); Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType); Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1); Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City); Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State); Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country); Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode); for (int i = 0; i < 1; i++) { Assert.AreEqual(expected.OrderDisplayItemList[i].OrderQuantity, actual.OrderDisplayItemList[i].OrderQuantity); Assert.AreEqual(expected.OrderDisplayItemList[i].ProductName, actual.OrderDisplayItemList[i].ProductName); Assert.AreEqual(expected.OrderDisplayItemList[i].PurchasePrice, actual.OrderDisplayItemList[i].PurchasePrice); } }
public ActionResult Login(OrderDisplay model) { var userList = Repo.GetUsers(); OrderDisplay order = new OrderDisplay(); order.FirstName = model.FirstName; order.LastName = model.LastName; bool exists = false; foreach (var user in userList) { if (user.FirstName == model.FirstName && user.LastName == model.LastName) { order.UserID = user.UserID; order.StoreLocation = user.StoreLocation; order.OrderPref = user.OrderPref; exists = true; break; } } if (exists == false) { Lib.EndUser user = new Lib.EndUser() { FirstName = order.FirstName, LastName = order.LastName }; Repo.AddUser(user); Repo.Save(); } return(View("PlaceOrder", order)); }
/// <summary> /// Display datagridviewOrder /// </summary> public void DisplayOder() { //open the RosePurchaseEntities context using (RosePurchaseManagementEntities context = new RosePurchaseManagementEntities()) { //Create a list to display order List <OrderDisplay> orderDisplayList = new List <OrderDisplay>(); //set up each properties for each OrderlIst Object var orderList = (from rose in context.Roses from size in rose.RoseSizes from order in size.Orders select new { oderid = order.OrderID, name = rose.RoseName, bunches = order.Number_of_bunches, }).ToList(); foreach (var order in orderList) { OrderDisplay orderDisplay = new OrderDisplay() { OderId = order.oderid, NumberOfBunches = order.bunches, RoseName = order.name }; orderDisplayList.Add(orderDisplay); } //set up datasource for dataGridViewOrder dataGridViewOrder.DataSource = orderDisplayList; } }
public ShipMethodDisplay GetShipMethod(OrderDisplay order) { var invoice = _invoiceService.GetByKey(order.InvoiceKey); if (invoice == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } var shipmentLineItem = invoice.Items.FirstOrDefault(x => x.LineItemType == LineItemType.Shipping); if (shipmentLineItem == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } var shipment = shipmentLineItem.ExtendedData.GetShipment<InvoiceLineItem>(); if (shipment == null) { throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound)); } if (shipment.ShipMethodKey != null) { var shipMethod = _shipMethodService.GetByKey(shipment.ShipMethodKey.Value); if (shipMethod == null) return new ShipMethodDisplay() { Name = "Not Found" }; return shipMethod.ToShipMethodDisplay(); } return new ShipMethodDisplay() { Name = "Not Found" }; }
public ShipmentDisplay NewShipment(OrderDisplay order) { try { if (!order.Items.Any()) { throw new InvalidOperationException("The shipment did not include any line items"); } var merchOrder = _orderService.GetByKey(order.Key); var builder = new ShipmentBuilderChain(MerchelloContext, order.ToOrder(merchOrder)); var attempt = builder.Build(); if (!attempt.Success) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, attempt.Exception)); } return(attempt.Result.ToShipmentDisplay()); } catch (Exception ex) { throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, String.Format("{0}", ex.Message))); } }
public ActionResult OrderProductFiles() { var query = (from p in db.Order_Products join o in db.Product on p.product_id equals o.product_id select new { Order_Id = p.product_id, Product_Name = o.product_name, Add_To_Cart_Order = p.add_to_cart_order, Reordered = p.product_id }).ToList(); List <OrderDisplay> orderList = new List <OrderDisplay>(); foreach (var ord in query) { OrderDisplay ordDis = new OrderDisplay(); ordDis.Order_Id = ord.Order_Id; ordDis.Product_Name = ord.Product_Name; ordDis.Add_To_Cart_Order = ord.Add_To_Cart_Order; ordDis.Reordered = ord.Reordered; orderList.Add(ordDis); } return(View(orderList)); }
public void RetrieveOrderDisplayTest() { //Arrange var orderRepository = new OrderRepository(); var expected = new OrderDisplay() { FirstName = "Zelimir", LastName = "Ilic", OrderDate = new DateTimeOffset(2018, 2, 14, 10, 00, 00, new TimeSpan(1, 0, 0)), ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Majke Jevrosime bb", StreetLine2 = "selo Zuce", City = "Beograd", State = "Srbija", PostalCode = "11000", Country = "Srbija" }, OrderDisplayItemList = new List <OrderDisplayItem>() { new OrderDisplayItem() { OrderQuantity = 2, ProductName = "Tulips", PurchasePrice = 12.54M }, new OrderDisplayItem() { OrderQuantity = 1, ProductName = "Raketa", PurchasePrice = 6M } } }; //Act var actual = orderRepository.RetrieveOrderDisplay(10); Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.OrderDate, actual.OrderDate); Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType); Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1); Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City); Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State); Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode); Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country); for (int i = 0; i < 1; i++) { Assert.AreEqual(expected.OrderDisplayItemList[i].OrderQuantity, actual.OrderDisplayItemList[i].OrderQuantity); Assert.AreEqual(expected.OrderDisplayItemList[i].ProductName, actual.OrderDisplayItemList[i].ProductName); Assert.AreEqual(expected.OrderDisplayItemList[i].PurchasePrice, actual.OrderDisplayItemList[i].PurchasePrice); } //Assert }
//Take Order public ActionResult OrderMenu() { OrderDisplay order = new OrderDisplay(); ViewBag.obj = order.DisplayOrder(); return(View()); }
public void RetrieveOrderDisplayTest() { //-- Arrange var orderRepo = new OrderRepository(); var expected = new OrderDisplay() { FirstName = "aaa", LastName = "bbb", OrderDate = new DateTimeOffset(2014, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)), ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "street 1", StreetLine2 = "street 2", City = "city", State = "state", Country = "country", PostalCode = "8250" }, OrderDisplayItemList = new List <OrderDisplayItem>() { new OrderDisplayItem() { ProductName = "aaa", PurchasePrice = 10.12M, OrderQuantity = 5 }, new OrderDisplayItem() { ProductName = "bbb", PurchasePrice = 2.2M, OrderQuantity = 50 } } }; //-- Act var actual = orderRepo.RetrieveOrderDisplay(10); //-- Assert Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.OrderDate, actual.OrderDate); Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType); Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1); Assert.AreEqual(expected.ShippingAddress.StreetLine2, actual.ShippingAddress.StreetLine2); Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City); Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State); Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country); Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode); for (int i = 0; i < 1; i++) { Assert.AreEqual(expected.OrderDisplayItemList[i].OrderQuantity, actual.OrderDisplayItemList[i].OrderQuantity); Assert.AreEqual(expected.OrderDisplayItemList[i].ProductName, actual.OrderDisplayItemList[i].ProductName); Assert.AreEqual(expected.OrderDisplayItemList[i].PurchasePrice, actual.OrderDisplayItemList[i].PurchasePrice); } }
public void RetrieveOrderDiplayTest() { //arrange var orderRepository = new OrderRepository(); var expected = new OrderDisplay() { FirstName = "Glenn", LastName = "Danzig", OrderDate = new DateTimeOffset(2018, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)), ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Kitten Town", StreetLine2 = "Kitten Circle", City = "Hoboken", State = "New Jersey", Country = "United States", PostalCode = "666" }, orderDisplayItemList = new List <OrderDisplayItem>() { new OrderDisplayItem() { ProductName = "Sure Step Kitty Litter", PurchasePrice = 16.99M, OrderQuantity = 2 }, new OrderDisplayItem() { ProductName = "Litter Box Scooper", PurchasePrice = 6M, OrderQuantity = 1 } } }; //act var actual = orderRepository.RetrieveOrderDisplay(10); //assert Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.OrderDate, actual.OrderDate); Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType); Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1); Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City); Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State); Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country); Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode); for (int i = 0; i < 1; i++) { Assert.AreEqual(expected.orderDisplayItemList[i].OrderQuantity, actual.orderDisplayItemList[i].OrderQuantity); Assert.AreEqual(expected.orderDisplayItemList[i].ProductName, actual.orderDisplayItemList[i].ProductName); Assert.AreEqual(expected.orderDisplayItemList[i].PurchasePrice, actual.orderDisplayItemList[i].PurchasePrice); } }
void SpawnScoreParticle(Griddle griddle, OrderDisplay target, int points) { ObjectPooler.Current.Spawn <ScoreGainParticle>("ScoreGainParticle", x => { x.Source = griddle.GetWorldPosition(); x.Destination = target.GetWorldPosition(); x.PercentTraveled = 0; x.Points = points; }); }
public void RetrieveOrderDisplayTest() { //Arrange var orderRepository = new OrderRepository(); var expected = new OrderDisplay() { FirstName = "Duc", LastName = "Mai", OrderDate = new DateTimeOffset(2019, 2, 28, 23, 0, 0, TimeSpan.FromHours(+3)), ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bag End", StreetLine2 = "Bagshot row", City = "Quincy", State = "MA", Country = "United States", PostalCode = "02169" }, orderDisplayItemList = new List <OrderDisplayItem>() { new OrderDisplayItem() { OrderQuantity = 2, ProductName = "Sunflowers", PurchasePrice = 15.9M }, new OrderDisplayItem() { OrderQuantity = 1, ProductName = "Rake", PurchasePrice = 6M } } }; //Act var actual = orderRepository.RetrieveOrderDisplay(10); //Assert Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.OrderDate, actual.OrderDate); Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType); Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1); Assert.AreEqual(expected.ShippingAddress.StreetLine2, actual.ShippingAddress.StreetLine2); Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City); Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State); Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country); Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode); for (int i = 0; i < 1; i++) { Assert.AreEqual(expected.orderDisplayItemList[i].ProductName, actual.orderDisplayItemList[i].ProductName); Assert.AreEqual(expected.orderDisplayItemList[i].OrderQuantity, actual.orderDisplayItemList[i].OrderQuantity); Assert.AreEqual(expected.orderDisplayItemList[i].PurchasePrice, actual.orderDisplayItemList[i].PurchasePrice); } }
public OrderDisplay RetrieveOrderDisplay(int orderID) { OrderDisplay orderDisplay = new OrderDisplay(); //Code that retrieves the defined order field.. //Creare the instance of the Order class; //Pass in the request ID; Order order = new Order(orderID); //Temporary Hard - coded data in order to make Tests if (orderID == 10) { orderDisplay.FirstName = "Rich"; orderDisplay.LastName = "Strong"; orderDisplay.OrderDate = new DateTimeOffset(2015,4,12,9,00,00, new TimeSpan()); orderDisplay.ShippingAddress = new Address() { AddressType = 1, StreetLineOne = "Good Year", StreetLineTwo = "Good Harvest", City = "Brighton", State = "Central UK", Country = "bRIGHTON Area", PostCode = "144UK" }; } orderDisplay.OrderDisplayItemsList = new List<OrderDisplayItem>(); // Code that retrives the order items // Hardcode data.... if (orderID == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Beef meat", PurchasePrice = 8M, OrderQuantity = 1 }; orderDisplay.OrderDisplayItemsList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Sheep meat", PurchasePrice = 12M, OrderQuantity = 2 }; orderDisplay.OrderDisplayItemsList.Add(orderDisplayItem); } return orderDisplay; }
public void RetrieveOrderDispalyTest() { var orderRepository = new OrderRepository(); var expected = new OrderDisplay() { FirstName = "Queen", LastName = "Swain", OrderDate = new DateTimeOffset(2019, 3, 2, 7, 0, 0, TimeSpan.Zero), ShippingAddress = new Address() { AddressType = 1, City = "BBSR", Country = "India", State = "Odisha", StreetLine1 = "Lane no 8", StreetLine2 = "Shukhmeswar Temple", PostalCode = "751002" }, orderDisplayItemList = new List <OrderDisplayItem>() { new OrderDisplayItem() { ProductName = "Tshirt", PurchasePrice = 15.55m, OrderQuantity = 3 }, new OrderDisplayItem() { ProductName = "Pant", PurchasePrice = 55.55m, OrderQuantity = 3 } } }; var actual = orderRepository.RetrieveOrderDisplay(1); Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.OrderDate, actual.OrderDate); Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType); Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1); Assert.AreEqual(expected.ShippingAddress.StreetLine2, actual.ShippingAddress.StreetLine2); Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City); Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country); Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State); Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode); for (int i = 0; i < 1; i++) { Assert.AreEqual(expected.orderDisplayItemList[i].ProductName, actual.orderDisplayItemList[i].ProductName); Assert.AreEqual(expected.orderDisplayItemList[i].PurchasePrice, actual.orderDisplayItemList[i].PurchasePrice); Assert.AreEqual(expected.orderDisplayItemList[i].OrderQuantity, actual.orderDisplayItemList[i].OrderQuantity); } }
internal void LoadOrderDetail(OrderDisplay order) { var items = new List <OrderItemDisplay>(); foreach (var i in _model.SelectedOrder.Order.OrderItems) { items.Add(new OrderItemDisplay() { OrderItem = i, ProductName = i.Product.Name }); } _model.OrderItems = items; }
void Update5Seconds() { OrderDisplay time = FindObjectOfType <OrderDisplay>(); if (PlayerPrefs.GetInt("RecipeNumber", 0) < numberMaxOfRecipe) { Debug.Log(PlayerPrefs.GetInt("RecipeNumber", 0)); Create(); } else if (PlayerPrefs.GetInt("RecipeNumber", 0) >= numberMaxOfRecipe && time.timeLeft == 0) { this.DestroyRecipe(0); } }
public void RetrieveOrderDisplay() { //Arrange var orderRepository = new OrderRepository(); var expected = new OrderDisplay() { FirstName = "Linh", LastName = "Duy", OrderDate = new DateTimeOffset(2018, 10, 29, 0, 0, 0, TimeSpan.Zero), ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "StreetLine1", StreetLine2 = "StreetLine2", City = "HCM", State = "State", Country = "VietName", PostalCode = "70000" }, OrderDisplayItems = new List <OrderDisplayItem>() { new OrderDisplayItem() { ProductName = "Iphone", PurchasePrice = 10M, OrderQuantity = 2 }, new OrderDisplayItem() { ProductName = "Ipad", PurchasePrice = 20M, OrderQuantity = 2 } } }; //Act var actual = orderRepository.RetrieveOrderDisplay(10); //Assert Assert.AreEqual(expected.OrderId, actual.OrderId); Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.OrderDate, actual.OrderDate); Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType); Assert.AreEqual(expected.OrderDisplayItems[0].OrderQuantity, actual.OrderDisplayItems[0].OrderQuantity); }
public async Task <IActionResult> Display(int id) { OrderDisplay orderDisplay = new OrderDisplay(); orderDisplay.Order = await _orderData.GetOrderById(id); if (orderDisplay.Order != null) { var food = await _foodData.GetFood(); orderDisplay.ItemPurchased = food.Where(x => x.Id == orderDisplay.Order.FoodId).FirstOrDefault()?.Title; } return(View(orderDisplay)); }
public async Task <ActionResult> DetailsOrder(int id) { Order order = await _orderDataSource.GetOrderAsync(id); OrderDisplay orderDisplay = new OrderDisplay { Id = order.Id, PassportData = order.PassportData, StartDate = order.StartDate, FinalDate = order.FinalDate, AvailabilityDriver = order.AvailabilityDriver, CarId = order.CarId, NameOrderStatus = order.OrderStatus.Name, }; return(View(orderDisplay)); }
public void ServeOmelette(OrderDisplay order) { if (SelectedGriddle != null && IsPlaying() && SelectedGriddle.HasIngredients && !SelectedGriddle.IsCooking()) { var score = order.ServeOmelette(SelectedGriddle.Ingredients); if (score < order.CurrentOrder.PotentialScore()) { SoundBoard.Current.PlayOmeletteFailure(); } else { SoundBoard.Current.PlayOmeletteSuccess(); } SpawnScoreParticle(SelectedGriddle, order, score); SelectedGriddle.ClearGriddle(); } }
private XmlDocument LoadOrderLog() { OrderDisplay.Clear(); // Create the XmlDocument object. XmlDocument OrderLog = new XmlDocument(); // Load the document, and validate it against the schema. try { OrderLog.Load("..\\..\\OrderLog.xml"); } catch (Exception ex) { OrderDisplay.Text += ex.ToString(); } return(OrderLog); }
private static OrderDisplay ReaderToOrderDisplay(OleDbDataReader reader) { OrderDisplay order = new OrderDisplay(); order.OrderID = (int)reader[FIELD_ID]; order.OrderCustomer = (string)reader[FIELD_CUSTOMER]; order.OrderDate = (DateTime)reader[FIELD_DATE]; try { order.Price = (decimal)reader[FIELD_PRICE]; } catch { //order has no price yet (because no meals) order.Price = 0m; } return(order); }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); if (orderId == 10) { orderDisplay.FirstName = "Bilbo"; orderDisplay.LastName = "Baggins"; orderDisplay.OrderDate = new DateTimeOffset(2014, 4, 14, 10, 0, 0, new TimeSpan(7, 0, 0)); orderDisplay.ShippingAddress = new Address() { StreetLine1 = "Bag End", StreetLine2 = "Bagshot row", City = "Hobbiton", State = "Shire", Country = "Middle Earth", PostalCode = "144" }; } orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>(); if (orderId == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Sunflowers", PurchasePrice = 15.96M, OrderQuantity = 2 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderQuantity = 1 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); } return(orderDisplay); }
public void RetrieveOrderDisplayInvalidTest() { var orderRepo = new OrderRepository(); var expected = new OrderDisplay() { FirstName = "Bilbo", LastName = "Baggins", OrderDate = new DateTimeOffset(2014, TimeSpan.Zero), ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bagnd", StreetLine2 = "Bagshot row", City = "Hobiton", State = "Shire", Country = "Middle Earth", PostalCode = "1444" }, OrderDisplayItemList = new List <OrderDisplayItem>() { new OrderDisplayItem() { ProductName = "Sunflowers", PurchasePrice = 15.95M, OrderItemQuantity = 2 }, new OrderDisplayItem() { ProductName = "Rakes", PurchasePrice = 6M, OrderItemQuantity = 1 }, } }; var actual = orderRepo.RetrieveOrderDisplay(10); Assert.AreNotEqual(expected, actual); }
public OrderDisplay RetrieveOrderDisplay(int orderId) { OrderDisplay orderDisplay = new OrderDisplay(); var addressRepository = new AddressRepository(); if (orderId == 10) { orderDisplay.FirstName = "Steve"; orderDisplay.LastName = "Jobs"; orderDisplay.OrderDate = new DateTimeOffset(2018, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)); orderDisplay.ShippingAddress = addressRepository.Retrieve(1); } orderDisplay.OrderDisplayItemList = new List <OrderDisplayItem>(); if (orderId == 10) { var orderDisplayItem = new OrderDisplayItem() { ProductName = "Sunflowers", PurchasePrice = 15.96M, OrderQuantity = 2 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); orderDisplayItem = new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderQuantity = 1 }; orderDisplay.OrderDisplayItemList.Add(orderDisplayItem); } return(orderDisplay); }
public void RetrieveOrderDisplayTest() { //Arrange OrderDisplay expected = new OrderDisplay() { FirstName = "Zebby", ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "27 Lakeside Dr" }, orderDisplayItemList = new List <OrderDisplayItem>() { new OrderDisplayItem() { ProductName = "Sunflowers", OrderQuantity = 5 }, new OrderDisplayItem() { ProductName = "Cakes", OrderQuantity = 6 } } }; //Act OrderRepository orderRepository = new OrderRepository(); OrderDisplay actual = orderRepository.RetrieveOrderDisplay(10); //Assert for (int i = 0; i < actual.orderDisplayItemList.ToArray().Length; i++) { Assert.AreEqual(expected.orderDisplayItemList[i].ProductName, actual.orderDisplayItemList[i].ProductName); Assert.AreEqual(expected.orderDisplayItemList[i].OrderQuantity, actual.orderDisplayItemList[i].OrderQuantity); } }
public void RetrieveOrderDisplayTest() { var orderRepository = new OrderRepository(); var exprected = new OrderDisplay() { FirstName = "Bilbo", LastName = "Baggins", OrderDate = new DateTimeOffset(2014, 4, 14, 10, 00, 00, new TimeSpan(7, 0, 0)), ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bag End", StreetLine2 = "BagShot row", City = "Hobbiton", State = "Shire", Country = "Middle Earth", PostalCode = "144" }, OrderDisplayItemList = new List <OrderDisplayItem>() { new OrderDisplayItem() { OrderQuantity = 2, ProductName = "Sunflowers", PurchasePrice = 15.96M }, new OrderDisplayItem() { OrderQuantity = 3, ProductName = "Sunflowers1", PurchasePrice = 145.96M } } }; var actual = orderRepository.RetrieveOderDisplay(10); }
public void DequeueOrder(OrderDisplay order) { OrderQueue.Remove(order); }
public void RetrieveOrderDisplayTest() { //Arrange var orderRepository = new OrderRepository(); var expected = new OrderDisplay() { FirstName = "Damien", LastName = "Sweeney", OrderDate = new DateTimeOffset(2018, 6, 10, 0, 0, 0, new TimeSpan(-6, 0, 0)), ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "12 Catherine Howard Close", StreetLine2 = "", City = "Thetford", State = "Norfolk", Country = "United Kingdom", PostalCode = "IP24 1TQ" }, orderDisplayItemList = new List <OrderDisplayItem>() { new OrderDisplayItem() { ProductName = "Butt Butter Chamois Cream", PurchasePrice = 20.00m, OrderQuantity = 5 }, new OrderDisplayItem() { ProductName = "Wiggle Electrolytes", PurchasePrice = 2.00m, OrderQuantity = 12 } } }; //Act var actual = orderRepository.RetrieveOrderDisplay(10); //Assert Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.OrderDate, actual.OrderDate); Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType); Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1); Assert.AreEqual(expected.ShippingAddress.StreetLine2, actual.ShippingAddress.StreetLine2); Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City); Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State); Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country); Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode); for (int i = 0; i < 2; i++) { Assert.AreEqual(expected.orderDisplayItemList[i].ProductName, actual.orderDisplayItemList[i].ProductName); Assert.AreEqual(expected.orderDisplayItemList[i].OrderQuantity, actual.orderDisplayItemList[i].OrderQuantity); Assert.AreEqual(expected.orderDisplayItemList[i].PurchasePrice, actual.orderDisplayItemList[i].PurchasePrice); } }
public void RetrieveOrderDisplayTest() { // Arrange var orderRepository = new OrderRepository(); var expected = new OrderDisplay() { FirstName = "Bilbo", LastName = "Baggins", OrderDate = new DateTimeOffset(2015, 7, 29, 10, 00, 00, new TimeSpan()), ShippingAddress = new Address() { AddressType = 1, StreetLine1 = "Bag End", StreetLine2 = "Bagshot Row", City = "Hobbiton", State = "Shire", Country = "Middle Earth", PostalCode = "144" }, orderDisplayItemList = new List <OrderDisplayItem>() { new OrderDisplayItem() { ProductName = "Sunflowers", PurchasePrice = 15.96M, OrderQuantity = 2 }, new OrderDisplayItem() { ProductName = "Rake", PurchasePrice = 6M, OrderQuantity = 1 } } }; // Actual // *Had fun with this one. Good bug hunting experience. // OrderRepository above was set as = new OrderDisplay(); // *Below was unable to locate the reference orderRepository.??? // *Now corrected to be var orderRepository = new OrderRepository(); // #RememberingTheGoodTimes! var actual = orderRepository.RetrieveOrderDisplay(10); // Assertion Assert.AreEqual(expected.FirstName, actual.FirstName); Assert.AreEqual(expected.LastName, actual.LastName); Assert.AreEqual(expected.OrderDate, actual.OrderDate); Assert.AreEqual(expected.ShippingAddress.AddressType, actual.ShippingAddress.AddressType); Assert.AreEqual(expected.ShippingAddress.StreetLine1, actual.ShippingAddress.StreetLine1); Assert.AreEqual(expected.ShippingAddress.City, actual.ShippingAddress.City); Assert.AreEqual(expected.ShippingAddress.State, actual.ShippingAddress.State); Assert.AreEqual(expected.ShippingAddress.Country, actual.ShippingAddress.Country); Assert.AreEqual(expected.ShippingAddress.PostalCode, actual.ShippingAddress.PostalCode); for (int i = 0; i < 1; i++) { Assert.AreEqual(expected.orderDisplayItemList[i].OrderQuantity, actual.orderDisplayItemList[i].OrderQuantity); Assert.AreEqual(expected.orderDisplayItemList[i].ProductName, actual.orderDisplayItemList[i].ProductName); Assert.AreEqual(expected.orderDisplayItemList[i].PurchasePrice, actual.orderDisplayItemList[i].PurchasePrice); } }
public static OrderModel ToOrderViewModel(this OrderDisplay order, InvoiceDisplay invoice) { return(new OrderModel(order.Key) { }); }